You are here

protected function ViewListBuilder::getDisplayPaths in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/ViewListBuilder.php \Drupal\views_ui\ViewListBuilder::getDisplayPaths()

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.

1 call to ViewListBuilder::getDisplayPaths()
ViewListBuilder::buildRow in core/modules/views_ui/src/ViewListBuilder.php
Builds a row for an entity in the entity listing.

File

core/modules/views_ui/src/ViewListBuilder.php, line 267
Contains \Drupal\views_ui\ViewListBuilder.

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);
}