/** * Gets the displayable path of a page entity. * * @param \Drupal\page_manager\PageInterface $entity * The page entity. * * @return array|string * The value of the path. */ 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; } }