You are here

class RouteAlterSubscriber in Views Ajax Get 8

Same name and namespace in other branches
  1. 2.0.x src/EventSubscriber/RouteAlterSubscriber.php \Drupal\views_ajax_get\EventSubscriber\RouteAlterSubscriber

Hierarchy

  • class \Drupal\views_ajax_get\EventSubscriber\RouteAlterSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RouteAlterSubscriber

1 string reference to 'RouteAlterSubscriber'
views_ajax_get.services.yml in ./views_ajax_get.services.yml
views_ajax_get.services.yml
1 service uses RouteAlterSubscriber
views_ajax_get.route_alter in ./views_ajax_get.services.yml
\Drupal\views_ajax_get\EventSubscriber\RouteAlterSubscriber

File

src/EventSubscriber/RouteAlterSubscriber.php, line 9

Namespace

Drupal\views_ajax_get\EventSubscriber
View source
class RouteAlterSubscriber implements EventSubscriberInterface {
  public function onRouteAlter(RouteBuildEvent $event) {
    $collection = $event
      ->getRouteCollection();
    if ($route = $collection
      ->get('views.ajax')) {
      $route
        ->setDefault('_controller', '\\Drupal\\views_ajax_get\\Controller\\ViewsAjaxController::ajaxView');
    }
  }

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

}

Members

Namesort descending Modifiers Type Description Overrides
RouteAlterSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
RouteAlterSubscriber::onRouteAlter public function