function MenuExampleController::pathOverride
Same name in other branches
- 4.0.x modules/menu_example/src/Controller/MenuExampleController.php \Drupal\menu_example\Controller\MenuExampleController::pathOverride()
Demonstrate how one can alter the existing routes.
1 string reference to 'MenuExampleController::pathOverride'
- menu_example.routing.yml in modules/
menu_example/ menu_example.routing.yml - modules/menu_example/menu_example.routing.yml
File
-
modules/
menu_example/ src/ Controller/ MenuExampleController.php, line 262
Class
- MenuExampleController
- Controller routines for menu example routes.
Namespace
Drupal\menu_example\ControllerCode
public function pathOverride() {
return [
'#markup' => $this->t('This menu item was created strictly to allow the RouteSubscriber class to have something to operate on. menu_example.routing.yml defined the path as examples/menu-example/menu-original-path. The alterRoutes() changes it to /examples/menu-example/menu-altered-path. You can try navigating to both paths and see what happens!'),
];
}