You are here

protected function CurrentPathHelper::getCurrentPathUrls in Menu Trail By Path 8

Return value

\Drupal\Core\Url[]

1 call to CurrentPathHelper::getCurrentPathUrls()
CurrentPathHelper::getUrls in src/Path/CurrentPathHelper.php
@inheritdoc

File

src/Path/CurrentPathHelper.php, line 86

Class

CurrentPathHelper

Namespace

Drupal\menu_trail_by_path\Path

Code

protected function getCurrentPathUrls() {
  $urls = [];
  $path_elements = $this
    ->getPathElements();
  while (count($path_elements) > 1) {
    array_pop($path_elements);
    $url = $this
      ->createUrlFromRelativeUri('/' . implode('/', $path_elements));
    if ($url
      ->isRouted()) {
      $urls[] = $url;
    }
  }
  return array_reverse($urls);
}