You are here

public function MenuExampleController::permissionedControlled in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/menu_example/src/Controller/MenuExampleController.php \Drupal\menu_example\Controller\MenuExampleController::permissionedControlled()

Only accessible when the user will be granted with required permission.

The permission is defined in file menu_examples.permissions.yml.

1 string reference to 'MenuExampleController::permissionedControlled'
menu_example.routing.yml in menu_example/menu_example.routing.yml
menu_example/menu_example.routing.yml

File

menu_example/src/Controller/MenuExampleController.php, line 79

Class

MenuExampleController
Controller routines for menu example routes.

Namespace

Drupal\menu_example\Controller

Code

public function permissionedControlled() {
  return [
    '#markup' => $this
      ->t('This menu entry will not show and the page will not be accessible without the "access protected menu example" permission to current user.'),
  ];
}