protected AdminRouteSubscriber::alterRoutes(RouteCollection $collection)
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/system/src/EventSubscriber/AdminRouteSubscriber.php, line 17
Class
- AdminRouteSubscriber
- Adds the _admin_route option to each admin route.
Namespace
Drupal\system\EventSubscriber
Code
protected function alterRoutes(RouteCollection $collection) { foreach ($collection->all() as $route) { if (strpos($route->getPath(), '/admin') === 0 && !$route->hasOption('_admin_route')) { $route->setOption('_admin_route', TRUE); } } }
Please login to continue.