You are here

protected function RouteSubscriber::getViewsDisplayIDsWithRoute in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/EventSubscriber/RouteSubscriber.php \Drupal\views\EventSubscriber\RouteSubscriber::getViewsDisplayIDsWithRoute()
  2. 10 core/modules/views/src/EventSubscriber/RouteSubscriber.php \Drupal\views\EventSubscriber\RouteSubscriber::getViewsDisplayIDsWithRoute()

Gets all the views and display IDs using a route.

2 calls to RouteSubscriber::getViewsDisplayIDsWithRoute()
RouteSubscriber::alterRoutes in core/modules/views/src/EventSubscriber/RouteSubscriber.php
Alters existing routes for a specific collection.
RouteSubscriber::routes in core/modules/views/src/EventSubscriber/RouteSubscriber.php
Returns a set of route objects.

File

core/modules/views/src/EventSubscriber/RouteSubscriber.php, line 90

Class

RouteSubscriber
Builds up the routes of all views.

Namespace

Drupal\views\EventSubscriber

Code

protected function getViewsDisplayIDsWithRoute() {
  if (!isset($this->viewsDisplayPairs)) {
    $this->viewsDisplayPairs = [];

    // @todo Convert this method to some service.
    $views = $this
      ->getApplicableViews();
    foreach ($views as $data) {
      list($view_id, $display_id) = $data;
      $this->viewsDisplayPairs[] = $view_id . '.' . $display_id;
    }
    $this->viewsDisplayPairs = array_combine($this->viewsDisplayPairs, $this->viewsDisplayPairs);
  }
  return $this->viewsDisplayPairs;
}