src/Menu/FrontendMenuBuilder.php
public function createDropdownLangMenu(
        \Knp\Menu\ItemInterface &$menu,
        array $languages,
        $currentLanguage,
        $route = 'networking_init_change_language'
    ) {
        $dropdown = $menu->addChild(
            $this->translator->trans('Change Language'),
            ['dropdown' => true, 'icon' => 'caret']
        );

        foreach ($languages as $language) {
            $node = $dropdown->addChild(
                $language['label'],
                ['uri' => $this->router->generate($route, ['oldLocale' => $this->request->getLocale(), 'locale' => $language['locale']])]
            );

            if ($language['locale'] == $currentLanguage) {
                $node->setCurrent(true);
            }
            $node->setExtra('translation_domain', false);
        }
    }
public function createDropdownLangMenu(
        \Knp\Menu\ItemInterface &$menu,
        array $languages,
        $currentLanguage,
        $route = 'networking_init_change_language'
    ) {
        $dropdown = $menu->addChild(
            $this->translator->trans('Change Language'),
            ['dropdown' => true, 'icon' => 'caret']
        );

        foreach ($languages as $language) {
            $node = $dropdown->addChild(
                $language['label'],
                ['uri' => $this->router->generate($route, ['oldLocale' => $this->request->getLocale(), 'locale' => $language['locale']])]
            );

            if ($language['locale'] == $currentLanguage) {
                $node->setCurrent(true);
            }
            $node->setExtra('translation_domain', false);
        }
    }
public function createDropdownLangMenu ( \ Knp \ Menu \ ItemInterface & $ menu , array $ languages , $ currentLanguage , $ route = 'networking_init_change_language' ) { $ dropdown = $ menu -> addChild ( $ this -> translator -> trans ( 'Change Language' ) , [ 'dropdown' => true , 'icon' => 'caret' ] ) ; foreach ( $ languages as $ language ) { $ node = $ dropdown -> addChild ( $ language [ 'label' ] , [ 'uri' => $ this -> router -> generate ( $ route , [ 'oldLocale' => $ this -> request -> getLocale ( ) , 'locale' => $ language [ 'locale' ] ] ) ] ) ; if ( $ language [ 'locale' ] == $ currentLanguage ) { $ node -> setCurrent ( true ) ; } $ node -> setExtra ( 'translation_domain' , false ) ; } }
Used to create nodes for the language navigation in the front- and backend.

@param \Knp\Menu\ItemInterface $menu
@param array                   $languages
@param $currentLanguage
@param string $route
Used to create nodes for the language navigation in the front - and backend .