You are here

protected function GroupAdminRouteSubscriber::alterRoutes in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Routing/GroupAdminRouteSubscriber.php \Drupal\group\Routing\GroupAdminRouteSubscriber::alterRoutes()

Alters existing routes for a specific collection.

Parameters

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

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/GroupAdminRouteSubscriber.php, line 34

Class

GroupAdminRouteSubscriber
Sets the _admin_route for specific group-related routes.

Namespace

Drupal\group\Routing

Code

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