You are here

protected function LogAdminRouteSubscriber::alterRoutes in Log entity 8

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

src/EventSubscriber/LogAdminRouteSubscriber.php, line 39
Contains \Drupal\log\EventSubscriber\LogAdminRouteSubscriber.

Class

LogAdminRouteSubscriber
Sets the _admin_route for specific log-related routes.

Namespace

Drupal\log\EventSubscriber

Code

protected function alterRoutes(RouteCollection $collection) {
  if ($this->configFactory
    ->get('log.settings')
    ->get('log_use_admin_theme')) {
    foreach ($collection
      ->all() as $route) {
      if ($route
        ->hasOption('_log_operation_route')) {
        $route
          ->setOption('_admin_route', TRUE);
      }
    }
  }
}