You are here

public function RouteSubscriber::alterRoutes in File Entity (fieldable files) 8.2

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/RouteSubscriber.php, line 16

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\file_entity\Routing

Code

public function alterRoutes(RouteCollection $collection) {

  // The usage view should be shown in the admin theme.
  if ($route = $collection
    ->get('view.file_entity_files.usage')) {
    $route
      ->setOption('_admin_route', TRUE);
  }
}