bundle/Helper/PathHelper.php
public function getPath($locationId, array $options = []): array
    {
        $optionsResolver = new OptionsResolver();
        $this->configureOptions($optionsResolver);
        $options = $optionsResolver->resolve($options);

        $excludedContentTypes = [];
        if (
            !$options['use_all_content_types'] &&
            $this->configResolver->hasParameter('path_helper.excluded_content_types', 'ngsite')
        ) {
            $excludedContentTypes = $this->configResolver->getParameter('path_helper.excluded_content_types', 'ngsite');
            if (!is_array($excludedContentTypes)) {
                $excludedContentTypes = [];
            }
        }

        // The root location can be defined at site access level
        $rootLocationId = (int) $this->configResolver->getParameter('content.tree_root.location_id');

        $path = $this->loadService->loadLocation($locationId)->path;

        // Shift of location "1" from path as it is not a fully valid location and not readable by most users
        array_shift($path);

        $pathArray = [];
        $rootLocationFound = false;
        foreach ($path as $index => $pathItem) {
            if ((int) $pathItem === $rootLocationId) {
                $rootLocationFound = true;
            }

            if (!$rootLocationFound) {
                continue;
            }

            try {
                $location = $this->loadService->loadLocation($pathItem);
            } catch (UnauthorizedException $e) {
                return [];
            }

            if (!in_array($location->contentInfo->contentTypeIdentifier, $excludedContentTypes, true)) {
                $pathArray[] = [
                    'text' => $location->contentInfo->name,
                    'url' => $location->id !== (int) $locationId ?
                        $this->router->generate(
                            $location,
                            [],
                            $options['absolute_url'] ?
                                UrlGeneratorInterface::ABSOLUTE_URL :
                                UrlGeneratorInterface::ABSOLUTE_PATH
                        ) :
                        false,
                    'location' => $location,
                ];
            }
        }

        return $pathArray;
    }
public function getPath($locationId, array $options = []): array
    {
        $optionsResolver = new OptionsResolver();
        $this->configureOptions($optionsResolver);
        $options = $optionsResolver->resolve($options);

        $excludedContentTypes = [];
        if (
            !$options['use_all_content_types'] &&
            $this->configResolver->hasParameter('path_helper.excluded_content_types', 'ngsite')
        ) {
            $excludedContentTypes = $this->configResolver->getParameter('path_helper.excluded_content_types', 'ngsite');
            if (!is_array($excludedContentTypes)) {
                $excludedContentTypes = [];
            }
        }

        // The root location can be defined at site access level
        $rootLocationId = (int) $this->configResolver->getParameter('content.tree_root.location_id');

        $path = $this->loadService->loadLocation($locationId)->path;

        // Shift of location "1" from path as it is not a fully valid location and not readable by most users
        array_shift($path);

        $pathArray = [];
        $rootLocationFound = false;
        foreach ($path as $index => $pathItem) {
            if ((int) $pathItem === $rootLocationId) {
                $rootLocationFound = true;
            }

            if (!$rootLocationFound) {
                continue;
            }

            try {
                $location = $this->loadService->loadLocation($pathItem);
            } catch (UnauthorizedException $e) {
                return [];
            }

            if (!in_array($location->contentInfo->contentTypeIdentifier, $excludedContentTypes, true)) {
                $pathArray[] = [
                    'text' => $location->contentInfo->name,
                    'url' => $location->id !== (int) $locationId ?
                        $this->router->generate(
                            $location,
                            [],
                            $options['absolute_url'] ?
                                UrlGeneratorInterface::ABSOLUTE_URL :
                                UrlGeneratorInterface::ABSOLUTE_PATH
                        ) :
                        false,
                    'location' => $location,
                ];
            }
        }

        return $pathArray;
    }
public function getPath ( $ locationId , array $ options = [ ] ) : array { $ optionsResolver = new OptionsResolver ( ) ; $ this -> configureOptions ( $ optionsResolver ) ; $ options = $ optionsResolver -> resolve ( $ options ) ; $ excludedContentTypes = [ ] ; if ( ! $ options [ 'use_all_content_types' ] && $ this -> configResolver -> hasParameter ( 'path_helper.excluded_content_types' , 'ngsite' ) ) { $ excludedContentTypes = $ this -> configResolver -> getParameter ( 'path_helper.excluded_content_types' , 'ngsite' ) ; if ( ! is_array ( $ excludedContentTypes ) ) { $ excludedContentTypes = [ ] ; } } // The root location can be defined at site access level $ rootLocationId = ( int ) $ this -> configResolver -> getParameter ( 'content.tree_root.location_id' ) ; $ path = $ this -> loadService -> loadLocation ( $ locationId ) -> path ; // Shift of location "1" from path as it is not a fully valid location and not readable by most users array_shift ( $ path ) ; $ pathArray = [ ] ; $ rootLocationFound = false ; foreach ( $ path as $ index => $ pathItem ) { if ( ( int ) $ pathItem === $ rootLocationId ) { $ rootLocationFound = true ; } if ( ! $ rootLocationFound ) { continue ; } try { $ location = $ this -> loadService -> loadLocation ( $ pathItem ) ; } catch ( UnauthorizedException $ e ) { return [ ] ; } if ( ! in_array ( $ location -> contentInfo -> contentTypeIdentifier , $ excludedContentTypes , true ) ) { $ pathArray [ ] = [ 'text' => $ location -> contentInfo -> name , 'url' => $ location -> id !== ( int ) $ locationId ? $ this -> router -> generate ( $ location , [ ] , $ options [ 'absolute_url' ] ? UrlGeneratorInterface :: ABSOLUTE_URL : UrlGeneratorInterface :: ABSOLUTE_PATH ) : false , 'location' => $ location , ] ; } } return $ pathArray ; }
Returns the path array for provided location ID.

@param int|string $locationId
Returns the path array for provided location ID .