public function onRouteReferenceGeneration(RouteReferenceGenerationEvent $event)
    {
        $routeReference = $event->getRouteReference();
        if (!$routeReference->has('language')) {
            return;
        }

        $language = $routeReference->get('language');
        $routeReference->remove('language');
        $siteAccess = $this->translationHelper->getTranslationSiteAccess($language);
        if ($siteAccess !== null) {
            $routeReference->set('siteaccess', $siteAccess);
        }
    }
public function onRouteReferenceGeneration(RouteReferenceGenerationEvent $event)
    {
        $routeReference = $event->getRouteReference();
        if (!$routeReference->has('language')) {
            return;
        }

        $language = $routeReference->get('language');
        $routeReference->remove('language');
        $siteAccess = $this->translationHelper->getTranslationSiteAccess($language);
        if ($siteAccess !== null) {
            $routeReference->set('siteaccess', $siteAccess);
        }
    }
public function onRouteReferenceGeneration ( RouteReferenceGenerationEvent $ event ) { $ routeReference = $ event -> getRouteReference ( ) ; if ( ! $ routeReference -> has ( 'language' ) ) { return ; } $ language = $ routeReference -> get ( 'language' ) ; $ routeReference -> remove ( 'language' ) ; $ siteAccess = $ this -> translationHelper -> getTranslationSiteAccess ( $ language ) ; if ( $ siteAccess !== null ) { $ routeReference -> set ( 'siteaccess' , $ siteAccess ) ; } }
If "language" parameter is present, will try to get corresponding SiteAccess for translation.
If found, it will add "siteaccess" parameter to the RouteReference, to trigger SiteAccess switch when generating
the final link.

@see \eZ\Publish\Core\MVC\Symfony\Routing\Generator::generate()
@see \eZ\Publish\Core\MVC\Symfony\Routing\Generator\UrlAliasGenerator::doGenerate()

@param \eZ\Publish\Core\MVC\Symfony\Event\RouteReferenceGenerationEvent $event
If language parameter is present will try to get corresponding SiteAccess for translation . If found it will add siteaccess parameter to the RouteReference to trigger SiteAccess switch when generating the final link .