You are here

protected function RouteSubscriber::alterRoutes in Core Context 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/Routing/RouteSubscriber.php, line 16

Class

RouteSubscriber
Modifies certain canonical entity routes to expose contexts.

Namespace

Drupal\core_context\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  $route = $collection
    ->get('entity.node.canonical');
  if ($route) {
    $route
      ->setDefault('_core_context_entity', 'node.full');
  }
}