src/Sulu/Bundle/WebsiteBundle/Twig/Meta/MetaTwigExtension.php
public function getAlternateLinks($urls)
    {
        // determine default and current values
        $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
        $currentPortal = $this->requestAnalyzer->getPortal();

        $defaultLocale = null;
        if (null !== $currentPortal && null !== ($defaultLocale = $currentPortal->getXDefaultLocalization())) {
            $defaultLocale = $defaultLocale->getLocale();
        }

        $result = [];
        foreach ($urls as $locale => $url) {
            // url = '/' means that there is no translation for this page
            // the only exception is the homepage where the requested resource-locator is '/'
            if ('/' !== $url || '/' === $this->requestAnalyzer->getResourceLocator()) {
                if ($locale === $defaultLocale) {
                    $result[] = $this->getAlternate($url, $webspaceKey, $locale, true);
                }
                $result[] = $this->getAlternate($url, $webspaceKey, $locale);
            }
        }

        return implode(PHP_EOL, $result);
    }
public function getAlternateLinks($urls)
    {
        // determine default and current values
        $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
        $currentPortal = $this->requestAnalyzer->getPortal();

        $defaultLocale = null;
        if (null !== $currentPortal && null !== ($defaultLocale = $currentPortal->getXDefaultLocalization())) {
            $defaultLocale = $defaultLocale->getLocale();
        }

        $result = [];
        foreach ($urls as $locale => $url) {
            // url = '/' means that there is no translation for this page
            // the only exception is the homepage where the requested resource-locator is '/'
            if ('/' !== $url || '/' === $this->requestAnalyzer->getResourceLocator()) {
                if ($locale === $defaultLocale) {
                    $result[] = $this->getAlternate($url, $webspaceKey, $locale, true);
                }
                $result[] = $this->getAlternate($url, $webspaceKey, $locale);
            }
        }

        return implode(PHP_EOL, $result);
    }
public function getAlternateLinks ( $ urls ) { // determine default and current values $ webspaceKey = $ this -> requestAnalyzer -> getWebspace ( ) -> getKey ( ) ; $ currentPortal = $ this -> requestAnalyzer -> getPortal ( ) ; $ defaultLocale = null ; if ( null !== $ currentPortal && null !== ( $ defaultLocale = $ currentPortal -> getXDefaultLocalization ( ) ) ) { $ defaultLocale = $ defaultLocale -> getLocale ( ) ; } $ result = [ ] ; foreach ( $ urls as $ locale => $ url ) { // url = '/' means that there is no translation for this page // the only exception is the homepage where the requested resource-locator is '/' if ( '/' !== $ url || '/' === $ this -> requestAnalyzer -> getResourceLocator ( ) ) { if ( $ locale === $ defaultLocale ) { $ result [ ] = $ this -> getAlternate ( $ url , $ webspaceKey , $ locale , true ) ; } $ result [ ] = $ this -> getAlternate ( $ url , $ webspaceKey , $ locale ) ; } } return implode ( PHP_EOL , $ result ) ; }
Returns alternate link HTML tags with href-lang attributes.

@param array $urls

@return string

@deprecated since 1.1 use SeoTwigExtension::renderSeoTags - sulu_seo
Returns alternate link HTML tags with href - lang attributes .