src/Sulu/Bundle/DocumentManagerBundle/Bridge/DocumentInspector.php
public function getLocalizedUrlsForPage(BasePageDocument $page)
    {
        $localizedUrls = [];
        $webspaceKey = $this->getWebspace($page);
        $webspace = $this->webspaceManager->findWebspaceByKey($webspaceKey);
        $node = $this->getNode($page);

        $structure = $this->getStructureMetadata($page);
        $resourceLocatorProperty = $structure->getPropertyByTagName('sulu.rlp');

        foreach ($webspace->getAllLocalizations() as $localization) {
            $resolvedLocale = $localization->getLocale();
            $locale = $resolvedLocale;

            $shadowEnabledName = $this->encoder->localizedSystemName(
                ShadowLocaleSubscriber::SHADOW_ENABLED_FIELD,
                $resolvedLocale
            );

            if (true === $node->getPropertyValueWithDefault($shadowEnabledName, false)) {
                $shadowLocaleName = $this->encoder->localizedSystemName(
                    ShadowLocaleSubscriber::SHADOW_LOCALE_FIELD,
                    $resolvedLocale
                );
                $resolvedLocale = $node->getPropertyValue($shadowLocaleName);
            }

            $stageName = $this->encoder->localizedSystemName(
                WorkflowStageSubscriber::WORKFLOW_STAGE_FIELD,
                $resolvedLocale
            );

            if (false === $node->hasProperty($stageName)) {
                continue;
            }

            $stage = $node->getProperty($stageName);

            if (WorkflowStage::PUBLISHED !== $stage->getValue()) {
                continue;
            }

            $url = $node->getPropertyValueWithDefault(
                $this->encoder->localizedContentName($resourceLocatorProperty->getName(), $locale),
                null
            );

            if (null === $url) {
                continue;
            }

            $localizedUrls[$locale] = $url;
        }

        return $localizedUrls;
    }
public function getLocalizedUrlsForPage(BasePageDocument $page)
    {
        $localizedUrls = [];
        $webspaceKey = $this->getWebspace($page);
        $webspace = $this->webspaceManager->findWebspaceByKey($webspaceKey);
        $node = $this->getNode($page);

        $structure = $this->getStructureMetadata($page);
        $resourceLocatorProperty = $structure->getPropertyByTagName('sulu.rlp');

        foreach ($webspace->getAllLocalizations() as $localization) {
            $resolvedLocale = $localization->getLocale();
            $locale = $resolvedLocale;

            $shadowEnabledName = $this->encoder->localizedSystemName(
                ShadowLocaleSubscriber::SHADOW_ENABLED_FIELD,
                $resolvedLocale
            );

            if (true === $node->getPropertyValueWithDefault($shadowEnabledName, false)) {
                $shadowLocaleName = $this->encoder->localizedSystemName(
                    ShadowLocaleSubscriber::SHADOW_LOCALE_FIELD,
                    $resolvedLocale
                );
                $resolvedLocale = $node->getPropertyValue($shadowLocaleName);
            }

            $stageName = $this->encoder->localizedSystemName(
                WorkflowStageSubscriber::WORKFLOW_STAGE_FIELD,
                $resolvedLocale
            );

            if (false === $node->hasProperty($stageName)) {
                continue;
            }

            $stage = $node->getProperty($stageName);

            if (WorkflowStage::PUBLISHED !== $stage->getValue()) {
                continue;
            }

            $url = $node->getPropertyValueWithDefault(
                $this->encoder->localizedContentName($resourceLocatorProperty->getName(), $locale),
                null
            );

            if (null === $url) {
                continue;
            }

            $localizedUrls[$locale] = $url;
        }

        return $localizedUrls;
    }
public function getLocalizedUrlsForPage ( BasePageDocument $ page ) { $ localizedUrls = [ ] ; $ webspaceKey = $ this -> getWebspace ( $ page ) ; $ webspace = $ this -> webspaceManager -> findWebspaceByKey ( $ webspaceKey ) ; $ node = $ this -> getNode ( $ page ) ; $ structure = $ this -> getStructureMetadata ( $ page ) ; $ resourceLocatorProperty = $ structure -> getPropertyByTagName ( 'sulu.rlp' ) ; foreach ( $ webspace -> getAllLocalizations ( ) as $ localization ) { $ resolvedLocale = $ localization -> getLocale ( ) ; $ locale = $ resolvedLocale ; $ shadowEnabledName = $ this -> encoder -> localizedSystemName ( ShadowLocaleSubscriber :: SHADOW_ENABLED_FIELD , $ resolvedLocale ) ; if ( true === $ node -> getPropertyValueWithDefault ( $ shadowEnabledName , false ) ) { $ shadowLocaleName = $ this -> encoder -> localizedSystemName ( ShadowLocaleSubscriber :: SHADOW_LOCALE_FIELD , $ resolvedLocale ) ; $ resolvedLocale = $ node -> getPropertyValue ( $ shadowLocaleName ) ; } $ stageName = $ this -> encoder -> localizedSystemName ( WorkflowStageSubscriber :: WORKFLOW_STAGE_FIELD , $ resolvedLocale ) ; if ( false === $ node -> hasProperty ( $ stageName ) ) { continue ; } $ stage = $ node -> getProperty ( $ stageName ) ; if ( WorkflowStage :: PUBLISHED !== $ stage -> getValue ( ) ) { continue ; } $ url = $ node -> getPropertyValueWithDefault ( $ this -> encoder -> localizedContentName ( $ resourceLocatorProperty -> getName ( ) , $ locale ) , null ) ; if ( null === $ url ) { continue ; } $ localizedUrls [ $ locale ] = $ url ; } return $ localizedUrls ; }
Returns urls for given page for all locales in webspace.

TODO: Implement a router service instead of this.

@param BasePageDocument $page

@return array
Returns urls for given page for all locales in webspace .