ViewListBuilder::getDisplayPaths

protected ViewListBuilder::getDisplayPaths(EntityInterface $view)

Gets a list of paths assigned to the view.

Parameters

\Drupal\Core\Entity\EntityInterface $view: The view entity.

Return value

array An array of paths for this view.

File

core/modules/views_ui/src/ViewListBuilder.php, line 267

Class

ViewListBuilder
Defines a class to build a listing of view entities.

Namespace

Drupal\views_ui

Code

protected function getDisplayPaths(EntityInterface $view) {
  $all_paths = array();
  $executable = $view->getExecutable();
  $executable->initDisplay();
  foreach ($executable->displayHandlers as $display) {
    if ($display->hasPath()) {
      $path = $display->getPath();
      if ($view->status() && strpos($path, '%') === FALSE) {
        // @todo Views should expect and store a leading /. See:
        //   https://www.drupal.org/node/2423913
        $all_paths[] = \Drupal::l('/' . $path, Url::fromUserInput('/' . $path));
      }
      else {
        $all_paths[] = '/' . $path;
      }
    }
  }
  return array_unique($all_paths);
}
doc_Drupal
2016-10-29 09:54:38
Comments
Leave a Comment

Please login to continue.