protected function NodeAdminRouteSubscriber::alterRoutes in Drupal 9
Same name and namespace in other branches
- 8 core/modules/node/src/EventSubscriber/NodeAdminRouteSubscriber.php \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber::alterRoutes()
- 10 core/modules/node/src/EventSubscriber/NodeAdminRouteSubscriber.php \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber::alterRoutes()
Alters existing routes for a specific collection.
Parameters
\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.
Overrides RouteSubscriberBase::alterRoutes
File
- core/
modules/ node/ src/ EventSubscriber/ NodeAdminRouteSubscriber.php, line 47
Class
- NodeAdminRouteSubscriber
- Sets the _admin_route for specific node-related routes.
Namespace
Drupal\node\EventSubscriberCode
protected function alterRoutes(RouteCollection $collection) {
if ($this->configFactory
->get('node.settings')
->get('use_admin_theme')) {
foreach ($collection
->all() as $route) {
if ($route
->hasOption('_node_operation_route')) {
$route
->setOption('_admin_route', TRUE);
}
}
}
}