3

How can I pass the complete path arguments to a route defined in a mymodule.routing.yml file?

example_archive.content_archiv:
  path: '/examplearchiv/{myvalue}'
  defaults:
  _controller: '\Drupal\example_archiv\Controller\exampleArchiveController::content_archiv'
   _title: 'example Archive'
requirements:
    _access: 'TRUE'
    myvalue: .+

For example:

  • /examplearchiv/testvalue gives $myvalue = 'testvalue' to the controller

  • /examplearchiv/testvalue/value1 causes a "page not found" error

  • /examplearchiv/testvalue/value1/value2 causes a "page not found" error

According to http://symfony.com/doc/current/routing/slash_in_parameter.html myvalue: .+ should also return slashes for {myvalue}; $myvalue should be 'testvalue/test1'.

5

Drupal 8 doesn't support this natively. You can add a simple class in a custom module that implements the InboundPathProcessorInterface that will allow this.

0

I am not sure why this wont work in your case. It should as per this. Apparently seems your route config has some problem with indentation. If so, it can cause the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.