Skip to content

Redirect target to static route can't use the route name #285

@fidelio314

Description

@fidelio314

Hello, i noticed in that the feedback redirect target parameter we can add only a url or an path.
Though if we have a multilingual website it is problematic.

for example on the config: boltforms.bolt.yml

...

    feedback:
        success: form.pionners.success_msg
        error: form.pionners.error_msg
        redirect:
            target: /mypath  # A page path, or URL
            query: [ email, code ]     # Optional keys for the GET parameters

for a my rooting config:


myroute:
     path: /mypath
     defaults:
         _controller: controller.frontend:template
         template: mytemplate

thought: /mypath with not work.

because i have actually these urls:

  • /fr/mypath
  • /en/mypath

this will work:

    feedback:
        success: form.pionners.success_msg
        error: form.pionners.error_msg
        redirect:
            target: /fr/mypath  # A page path, or URL
            query: [ email, code ]     # Optional keys for the GET parameters

it is impossible to add the route name.
this will not work:

target: myroute

because the RedirectableUrlMatcher is used into these files:

extensions/vendor/bolt/boltforms/src/Submission/Handler/Redirect.php
on the function: getRedirectResponse

does anyone have a way to make it work?

otherwise, what do you think it could be the best way to make it work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions