code: public function getPath($locationId)
      {
          $pathArray = array();
  
          $startingLocation = $this->locationService->loadLocation($locationId);
          $path = $startingLocation->path;
  
          // Shift of location "1" from path as it is not
          // a fully valid location and not readable by most users
          array_shift($path);
  
          $rootLocationFound = false;
          foreach ($path as $index => $pathItem) {
              if ((int) $pathItem === $this->rootLocationId) {
                  $rootLocationFound = true;
              }
  
              if (!$rootLocationFound) {
                  continue;
              }
  
              try {
                  $location = $this->locationService->loadLocation($pathItem);
              } catch (UnauthorizedException $e) {
                  return array();
              }
  
              $pathArray[] = array(
                  'text' => $this->translationHelper->getTranslatedContentNameByContentInfo(
                      $location->contentInfo
                  ),
                  'url' => $location->id !== $startingLocation->id ?
                      $this->router->generate($location) :
                      false,
                  'locationId' => $location->id,
                  'contentId' => $location->contentId,
              );
          }
  
          return $pathArray;
      }
docs: Returns the path array for location ID.
  
  @param mixed $locationId
  
  @return array