You are here

protected function CacheflushRouteSubscriber::alterRoutes in CacheFlush 8

Alters existing routes for a specific collection.

Parameters

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

Overrides RouteSubscriberBase::alterRoutes

File

modules/cacheflush_ui/src/Routing/CacheflushRouteSubscriber.php, line 16

Class

CacheflushRouteSubscriber
A route subscriber to remove routes that depend on modules being enabled.

Namespace

Drupal\cacheflush_ui\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  if ($route = $collection
    ->get('cacheflush.presets.clear_id')) {
    $route
      ->setRequirement('_entity_access', 'cacheflush.clear');
    $collection
      ->add('cacheflush.presets.clear_id', $route);
  }
}