vendor/lunetics/locale-bundle/Lunetics/LocaleBundle/Twig/Extension/LocaleSwitcherExtension.php
/**
     * @param string $route      A route name for which the switch has to be made
     * @param array  $parameters
     * @param string $template
     *
     * @return mixed
     */
@param string $route      A route name for which the switch has to be made
@param array  $parameters
@param string $template

@return mixed
@param string $route A route name for which the switch has to be made @param array $parameters @param string $template @return mixed
public function renderSwitcher($route = null, $parameters = array(), $template = null)
    {
        $showCurrentLocale = $this->container->getParameter('lunetics_locale.switcher.show_current_locale');
        $useController = $this->container->getParameter('lunetics_locale.switcher.use_controller');
        $allowedLocales = $this->container->get('lunetics_locale.allowed_locales_provider')->getAllowedLocales();
        $request = $this->container->has('request_stack')
            ? $this->container->get('request_stack')->getMasterRequest()
            : $this->container->get('request')
        ;
        $router = $this->container->get('router');
        $infosBuilder = new TargetInformationBuilder($request, $router, $allowedLocales, $showCurrentLocale, $useController);
        $infos = $infosBuilder->getTargetInformations($route, $parameters);
        return $this->container->get('lunetics_locale.switcher_helper')->renderSwitch($infos, $template);
    }
public function renderSwitcher ( $ route = null , $ parameters = array ( ) , $ template = null ) { $ showCurrentLocale = $ this -> container -> getParameter ( 'lunetics_locale.switcher.show_current_locale' ) ; $ useController = $ this -> container -> getParameter ( 'lunetics_locale.switcher.use_controller' ) ; $ allowedLocales = $ this -> container -> get ( 'lunetics_locale.allowed_locales_provider' ) -> getAllowedLocales ( ) ; $ request = $ this -> container -> has ( 'request_stack' ) ? $ this -> container -> get ( 'request_stack' ) -> getMasterRequest ( ) : $ this -> container -> get ( 'request' ) ; $ router = $ this -> container -> get ( 'router' ) ; $ infosBuilder = new TargetInformationBuilder ( $ request , $ router , $ allowedLocales , $ showCurrentLocale , $ useController ) ; $ infos = $ infosBuilder -> getTargetInformations ( $ route , $ parameters ) ; return $ this -> container -> get ( 'lunetics_locale.switcher_helper' ) -> renderSwitch ( $ infos , $ template ) ; }
@param string $route      A route name for which the switch has to be made
 @param array  $parameters
 @param string $template
@param string $route A route name for which the switch has to be made @param array $parameters @param string $template
// Use the request stack if it exists (Symfony 2.4+); otherwise use the request "service" // @see http://symfony.com/blog/new-in-symfony-2-4-the-request-stack