protected function configurePermalinkForNewLanguage($content)
    {
        if (null === $this->languageManager || null === $this->container) {
            return $content;
        }

        $urlManager = $this->container->get('red_kite_cms.url_manager');
        $languageName =  $this->languageManager->get()->getLanguageName();

        return preg_replace_callback('/(\<a[^\>]+href[="\'\s]+)([^"\'\s]+)?([^\>]+\>)/s', function ($matches) use ($urlManager, $languageName) {
            $url = $urlManager
                ->fromUrl($matches[2])
                ->getInternalUrl();

            return (null !== $url) ? $matches[1] . $languageName . '-' . $url . $matches[3] : $matches[1] . $matches[2] . $matches[3];
        }, $content);
    }
protected function configurePermalinkForNewLanguage($content)
    {
        if (null === $this->languageManager || null === $this->container) {
            return $content;
        }

        $urlManager = $this->container->get('red_kite_cms.url_manager');
        $languageName =  $this->languageManager->get()->getLanguageName();

        return preg_replace_callback('/(\<a[^\>]+href[="\'\s]+)([^"\'\s]+)?([^\>]+\>)/s', function ($matches) use ($urlManager, $languageName) {
            $url = $urlManager
                ->fromUrl($matches[2])
                ->getInternalUrl();

            return (null !== $url) ? $matches[1] . $languageName . '-' . $url . $matches[3] : $matches[1] . $matches[2] . $matches[3];
        }, $content);
    }
protected function configurePermalinkForNewLanguage ( $ content ) { if ( null === $ this -> languageManager || null === $ this -> container ) { return $ content ; } $ urlManager = $ this -> container -> get ( 'red_kite_cms.url_manager' ) ; $ languageName = $ this -> languageManager -> get ( ) -> getLanguageName ( ) ; return preg_replace_callback ( '/(\<a[^\>]+href[="\'\s]+)([^"\'\s]+)?([^\>]+\>)/s' , function ( $ matches ) use ( $ urlManager , $ languageName ) { $ url = $ urlManager -> fromUrl ( $ matches [ 2 ] ) -> getInternalUrl ( ) ; return ( null !== $ url ) ? $ matches [ 1 ] . $ languageName . '-' . $ url . $ matches [ 3 ] : $ matches [ 1 ] . $ matches [ 2 ] . $ matches [ 3 ] ; } , $ content ) ; }
Configures the permalink for the new language.

The content is parsed to find links. When at least a link is found it is retrieved and matched to find
if it is an internal link. When it is an internal link, it is prefixed with the new language as follows:
[new_language]-[permalink], otherwise it is left untouched

@param  string $content
@return string
Configures the permalink for the new language .