function DisplayPluginBase::getRoutedDisplay

Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getRoutedDisplay()
  2. 10 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getRoutedDisplay()
  3. 8.9.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getRoutedDisplay()

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 742

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function getRoutedDisplay() {
  // If this display has a route, return this display.
  if ($this instanceof DisplayRouterInterface) {
    return $this;
  }
  // If the display does not have a route (e.g. a block display), get the
  // route for the linked display.
  $display_id = $this->getLinkDisplay();
  if ($display_id && $this->view->displayHandlers
    ->has($display_id) && is_object($this->view->displayHandlers
    ->get($display_id))) {
    return $this->view->displayHandlers
      ->get($display_id)
      ->getRoutedDisplay();
  }
  // No routed display exists, so return NULL
  return NULL;
}

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