NodeAdminRouteSubscriber::alterRoutes

protected NodeAdminRouteSubscriber::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/node/src/EventSubscriber/NodeAdminRouteSubscriber.php, line 34

Class

NodeAdminRouteSubscriber
Sets the _admin_route for specific node-related routes.

Namespace

Drupal\node\EventSubscriber

Code

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);
      }
    }
  }
}
doc_Drupal
2016-10-29 09:30:35
Comments
Leave a Comment

Please login to continue.