AdminRouteSubscriber::alterRoutes

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);
    }
  }
}
doc_Drupal
2016-10-29 08:43:46
Comments
Leave a Comment

Please login to continue.