You are here

class RouteFilterSubscriber in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/EventSubscriber/RouteFilterSubscriber.php \Drupal\Core\EventSubscriber\RouteFilterSubscriber

Listens to the filtered collection of route instances.

Hierarchy

Expanded class hierarchy of RouteFilterSubscriber

1 string reference to 'RouteFilterSubscriber'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses RouteFilterSubscriber
route_filter_subscriber in core/core.services.yml
Drupal\Core\EventSubscriber\RouteFilterSubscriber

File

core/lib/Drupal/Core/EventSubscriber/RouteFilterSubscriber.php, line 18
Contains \Drupal\Core\EventSubscriber\RouteFilterSubscriber.

Namespace

Drupal\Core\EventSubscriber
View source
class RouteFilterSubscriber implements EventSubscriberInterface {

  /**
   * The lazy route filter.
   *
   * @var \Drupal\Core\Routing\LazyRouteFilter
   */
  protected $routeFilter;

  /**
   * Constructs the RouteFilterSubscriber object.
   *
   * @param \Drupal\Core\Routing\LazyRouteFilter $route_filter
   *   The lazy route filter.
   */
  public function __construct(LazyRouteFilter $route_filter) {
    $this->routeFilter = $route_filter;
  }

  /**
   * Get the Response object from filtered route collection.
   *
   * @param \Drupal\Core\Routing\RouteBuildEvent $event
   *   The route build event.
   */
  public function onRouteAlter(RouteBuildEvent $event) {
    $this->routeFilter
      ->setFilters($event
      ->getRouteCollection());
  }

  /**
   * {@inheritdoc}
   */
  static function getSubscribedEvents() {
    $events[RoutingEvents::ALTER][] = array(
      'onRouteAlter',
      -300,
    );
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteFilterSubscriber::$routeFilter protected property The lazy route filter.
RouteFilterSubscriber::getSubscribedEvents static function Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface::getSubscribedEvents
RouteFilterSubscriber::onRouteAlter public function Get the Response object from filtered route collection.
RouteFilterSubscriber::__construct public function Constructs the RouteFilterSubscriber object.