eZ\Publish\Core\Repository\URLAliasService::listLocationAliases PHP Метод

listLocationAliases() публичный Метод

List of url aliases pointing to $location, sorted by language priority.
public listLocationAliases ( eZ\Publish\API\Repository\Values\Content\Location $location, boolean $custom = true, string $languageCode = null, null | boolean $showAllTranslations = null, array $prioritizedLanguageList = null ) : eZ\Publish\API\Repository\Values\Content\URLAlias[]
$location eZ\Publish\API\Repository\Values\Content\Location
$custom boolean if true the user generated aliases are listed otherwise the autogenerated
$languageCode string filters those which are valid for the given language
$showAllTranslations null | boolean
$prioritizedLanguageList array
Результат eZ\Publish\API\Repository\Values\Content\URLAlias[]
    public function listLocationAliases(Location $location, $custom = true, $languageCode = null, $showAllTranslations = null, array $prioritizedLanguageList = null)
    {
        $spiUrlAliasList = $this->urlAliasHandler->listURLAliasesForLocation($location->id, $custom);
        if ($showAllTranslations === null) {
            $showAllTranslations = $this->settings['showAllTranslations'];
        }
        if ($prioritizedLanguageList === null) {
            $prioritizedLanguageList = $this->settings['prioritizedLanguageList'];
        }
        $urlAliasList = array();
        foreach ($spiUrlAliasList as $spiUrlAlias) {
            if (!$this->isUrlAliasLoadable($spiUrlAlias, $languageCode, $showAllTranslations, $prioritizedLanguageList)) {
                continue;
            }
            $path = $this->extractPath($spiUrlAlias, $languageCode, $showAllTranslations, $prioritizedLanguageList);
            if ($path === false) {
                continue;
            }
            $urlAliasList[$spiUrlAlias->id] = $this->buildUrlAliasDomainObject($spiUrlAlias, $path);
        }
        $prioritizedAliasList = array();
        foreach ($prioritizedLanguageList as $languageCode) {
            foreach ($urlAliasList as $urlAlias) {
                foreach ($urlAlias->languageCodes as $aliasLanguageCode) {
                    if ($aliasLanguageCode === $languageCode) {
                        $prioritizedAliasList[$urlAlias->id] = $urlAlias;
                        break;
                    }
                }
            }
        }
        // Add aliases not matched by prioritized language to the end of the list
        return array_values($prioritizedAliasList + $urlAliasList);
    }