You are here

protected function RouteSubscriber::getViewsDisplayIDsWithRoute in Drupal 10

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

Gets all the views and display IDs using a route.

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) {
      [
        $view_id,
        $display_id,
      ] = $data;
      $this->viewsDisplayPairs[] = $view_id . '.' . $display_id;
    }
    $this->viewsDisplayPairs = array_combine($this->viewsDisplayPairs, $this->viewsDisplayPairs);
  }
  return $this->viewsDisplayPairs;
}