You are here

RouteSubscriber.php in Core Context 8

File

src/Routing/RouteSubscriber.php
View source
<?php

namespace Drupal\core_context\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Modifies certain canonical entity routes to expose contexts.
 */
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');
    }
  }

}

Classes

Namesort descending Description
RouteSubscriber Modifies certain canonical entity routes to expose contexts.