You are here

final class RouteSubscriber in Core Context 8

Modifies certain canonical entity routes to expose contexts.

Hierarchy

Expanded class hierarchy of RouteSubscriber

1 string reference to 'RouteSubscriber'
core_context.services.yml in ./core_context.services.yml
core_context.services.yml
1 service uses RouteSubscriber
core_context.route_subscriber in ./core_context.services.yml
Drupal\core_context\Routing\RouteSubscriber

File

src/Routing/RouteSubscriber.php, line 11

Namespace

Drupal\core_context\Routing
View source
final class RouteSubscriber extends RouteSubscriberBase {

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

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1