function RouteSubscriber::getViewsDisplayIDsWithRoute

Same name 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()
  3. 11.x 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.