July 2017
Intermediate to advanced
456 pages
11h 32m
English
You can add optional tests for any of the parameters in the route. For each parameter, you can add a regular expression that's checked before matching the route. For example, the route for the node revisions is:
entity.node.version_history: path: '/node/{node}/revisions' defaults: _title: 'Revisions' _controller: '\Drupal\node\Controller\NodeController::revisionOverview' requirements: _access_node_revision: 'view' node: \d+ options: _node_operation_route: TRUE
Under requirements, you see the attribute for node with the regular expression \d+. This ensures that /node/1/revisions gets matched, while /node/foo/revisions doesn't.
Read now
Unlock full access