src/Controller/LanguageController.php
public function headerLanguageAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');

        $tableLang = $this->getServiceLocator()->get('MelisCoreTableLang');
        $moduleSvc = $this->getServiceLocator()->get('ModulesService');
        $datasLang = $tableLang->fetchAll();

        // Get the locale from session
        $container = new Container('meliscore');
        $currentLangLocale = $container['melis-lang-locale'];
        $currentLangLocale = explode('_', $currentLangLocale);
        $currentLangLocale = $currentLangLocale[0];

        // Get the langId from session
        $container = new Container('meliscore');
        $currentLangId = 1;
        if (!empty($container['melis-lang-id']))
            $currentLangId = $container['melis-lang-id'];

        $view = new ViewModel();
        $view->melisKey = $melisKey;
        $view->languages = $datasLang->toArray();
        $view->currentLangId = $currentLangId;
        $view->currentLangLocale = $currentLangLocale;
        $view->flagImagePath = $moduleSvc->getModulePath('MelisCore').'/public/assets/images/lang/';

        return $view;
    }
public function headerLanguageAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');

        $tableLang = $this->getServiceLocator()->get('MelisCoreTableLang');
        $moduleSvc = $this->getServiceLocator()->get('ModulesService');
        $datasLang = $tableLang->fetchAll();

        // Get the locale from session
        $container = new Container('meliscore');
        $currentLangLocale = $container['melis-lang-locale'];
        $currentLangLocale = explode('_', $currentLangLocale);
        $currentLangLocale = $currentLangLocale[0];

        // Get the langId from session
        $container = new Container('meliscore');
        $currentLangId = 1;
        if (!empty($container['melis-lang-id']))
            $currentLangId = $container['melis-lang-id'];

        $view = new ViewModel();
        $view->melisKey = $melisKey;
        $view->languages = $datasLang->toArray();
        $view->currentLangId = $currentLangId;
        $view->currentLangLocale = $currentLangLocale;
        $view->flagImagePath = $moduleSvc->getModulePath('MelisCore').'/public/assets/images/lang/';

        return $view;
    }
public function headerLanguageAction ( ) { $ melisKey = $ this -> params ( ) -> fromRoute ( 'melisKey' , '' ) ; $ tableLang = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreTableLang' ) ; $ moduleSvc = $ this -> getServiceLocator ( ) -> get ( 'ModulesService' ) ; $ datasLang = $ tableLang -> fetchAll ( ) ; // Get the locale from session $ container = new Container ( 'meliscore' ) ; $ currentLangLocale = $ container [ 'melis-lang-locale' ] ; $ currentLangLocale = explode ( '_' , $ currentLangLocale ) ; $ currentLangLocale = $ currentLangLocale [ 0 ] ; // Get the langId from session $ container = new Container ( 'meliscore' ) ; $ currentLangId = 1 ; if ( ! empty ( $ container [ 'melis-lang-id' ] ) ) $ currentLangId = $ container [ 'melis-lang-id' ] ; $ view = new ViewModel ( ) ; $ view -> melisKey = $ melisKey ; $ view -> languages = $ datasLang -> toArray ( ) ; $ view -> currentLangId = $ currentLangId ; $ view -> currentLangLocale = $ currentLangLocale ; $ view -> flagImagePath = $ moduleSvc -> getModulePath ( 'MelisCore' ) . '/public/assets/images/lang/' ; return $ view ; }
Shows language button in right corner of header

@return \Zend\View\Model\ViewModel
Shows language button in right corner of header