You are here

protected function EckEntityAdminRouteSubscriber::alterRoutes in Entity Construction Kit (ECK) 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/EckEntityAdminRouteSubscriber.php, line 34

Class

EckEntityAdminRouteSubscriber
Sets the _admin_route for specific eck-related routes.

Namespace

Drupal\eck\EventSubscriber

Code

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