You are here

protected function NodeAdminRouteSubscriber::alterRoutes in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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 39
Contains \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber.

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);
      }
    }
  }
}