function AccessRouteAlterSubscriber::accessAdminMenuBlockPage
Same name in other branches
- 10 core/modules/system/src/EventSubscriber/AccessRouteAlterSubscriber.php \Drupal\system\EventSubscriber\AccessRouteAlterSubscriber::accessAdminMenuBlockPage()
Adds _access_admin_menu_block_page requirement to routes pointing to SystemController::systemAdminMenuBlockPage.
Parameters
\Drupal\Core\Routing\RouteBuildEvent $event: The event to process.
File
-
core/
modules/ system/ src/ EventSubscriber/ AccessRouteAlterSubscriber.php, line 31
Class
- AccessRouteAlterSubscriber
- Alters routes to add necessary requirements.
Namespace
Drupal\system\EventSubscriberCode
public function accessAdminMenuBlockPage(RouteBuildEvent $event) {
$routes = $event->getRouteCollection();
foreach ($routes as $route) {
// Do not use a leading slash when comparing to the _controller string
// because the leading slash in a fully-qualified method name is optional.
if ($route->hasDefault('_controller')) {
switch (ltrim($route->getDefault('_controller'), '\\')) {
case 'Drupal\\system\\Controller\\SystemController::systemAdminMenuBlockPage':
$route->setRequirement('_access_admin_menu_block_page', 'TRUE');
break;
case 'Drupal\\system\\Controller\\SystemController::overview':
$route->setRequirement('_access_admin_overview_page', 'TRUE');
break;
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.