8000 [2.2] [Routing] Re-generating the current URL · Issue #4849 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[2.2] [Routing] Re-generating the current URL #4849
Closed
@Seldaek

Description

@Seldaek

(Derived from #2951)

Generating the current URL is sometimes useful, one common example is to create links to the same page with a different locale, but there are other use cases like multi-parameterized routes where you want to change one while keeping the rest intact.

I would like to propose the following alternatives (in twig helpers, but the same should be added to the UrlGenerator obviously):

  • {{ path(null, {foo:"bar"}) }}: null would generate the current route, and automatically merge the second arg with the current requests's _route_params.
  • {{ self({foo: "bar"}) }}: a new helper for this behavior instead of hackish null behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0