function MenuExampleController::permissioned
Same name in other branches
- 4.0.x modules/menu_example/src/Controller/MenuExampleController.php \Drupal\menu_example\Controller\MenuExampleController::permissioned()
A menu entry with simple permissions using 'access protected menu example'.
Throws
\InvalidArgumentException
1 string reference to 'MenuExampleController::permissioned'
- 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 65
Class
- MenuExampleController
- Controller routines for menu example routes.
Namespace
Drupal\menu_example\ControllerCode
public function permissioned() {
$url = Url::fromRoute('examples.menu_example.permissioned_controlled');
return [
'#markup' => $this->t('A menu item that requires the "access protected menu example" permission is at @link', [
'@link' => Link::createFromRoute($url->getInternalPath(), $url->getRouteName())
->toString(),
]),
];
}