class GroupMenuRouteSubscriber in Group Menu 8
Modify form for config.sync route.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\groupmenu\Routing\GroupMenuRouteSubscriber
Expanded class hierarchy of GroupMenuRouteSubscriber
1 string reference to 'GroupMenuRouteSubscriber'
1 service uses GroupMenuRouteSubscriber
File
- src/
Routing/ GroupMenuRouteSubscriber.php, line 11
Namespace
Drupal\groupmenu\RoutingView source
class GroupMenuRouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
$routes = $collection
->all();
foreach ($routes as $route_name => $route) {
switch ($route_name) {
case 'entity.menu.edit_form':
case 'entity.menu.add_link_form':
$route
->setRequirements([
'_custom_access' => '\\Drupal\\groupmenu\\Access\\GroupMenuAccess::menuEditAccess',
]);
break;
case 'entity.menu.delete_form':
$route
->setRequirements([
'_custom_access' => '\\Drupal\\groupmenu\\Access\\GroupMenuAccess::menuDeleteAccess',
]);
break;
case 'menu_ui.link_edit':
case 'menu_ui.link_reset':
$route
->setRequirements([
'_custom_access' => '\\Drupal\\groupmenu\\Access\\GroupMenuAccess::menuLinkAccess',
]);
break;
case 'entity.menu_link_content.canonical':
case 'entity.menu_link_content.delete_form':
$route
->setRequirements([
'_custom_access' => '\\Drupal\\groupmenu\\Access\\GroupMenuAccess::menuItemAccess',
]);
break;
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GroupMenuRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |