You are here

public function MenuExampleController::customAccessPage 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::customAccessPage()

Content will be displayed only if access check is satisfied.

See also

\Drupal\menu_example\Controller\MenuExampleController::customAccess()

1 string reference to 'MenuExampleController::customAccessPage'
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 106

Class

MenuExampleController
Controller routines for menu example routes.

Namespace

Drupal\menu_example\Controller

Code

public function customAccessPage() {
  return [
    '#markup' => $this
      ->t('This menu entry will not be visible and access will result
        in a 403 error unless the user has the "authenticated" role. This is
        accomplished with a custom access check plugin.'),
  ];
}