You are here

protected function PageListBuilder::getPath in Page Manager 8

Same name and namespace in other branches
  1. 8.4 page_manager_ui/src/Entity/PageListBuilder.php \Drupal\page_manager_ui\Entity\PageListBuilder::getPath()

Gets the displayable path of a page entity.

Parameters

\Drupal\page_manager\PageInterface $entity: The page entity.

Return value

array|string The value of the path.

1 call to PageListBuilder::getPath()
PageListBuilder::buildRow in page_manager_ui/src/Entity/PageListBuilder.php
Builds a row for an entity in the entity listing.

File

page_manager_ui/src/Entity/PageListBuilder.php, line 61
Contains \Drupal\page_manager_ui\Entity\PageListBuilder.

Class

PageListBuilder
Provides a list builder for page entities.

Namespace

Drupal\page_manager_ui\Entity

Code

protected function getPath(PageInterface $entity) {

  // If the page is enabled and not dynamic, show the path as a link,
  // otherwise as plain text.
  $path = $entity
    ->getPath();
  if ($entity
    ->status() && strpos($path, '%') === FALSE) {
    return [
      'data' => [
        '#type' => 'link',
        '#url' => Url::fromUserInput(rtrim($path, '/')),
        '#title' => $path,
      ],
    ];
  }
  else {
    return $path;
  }
}