Exemplo n.º 1
0
 public function init()
 {
     //parent::init();
     $session = Yii::$app->session;
     if (!$session['language_id']) {
         $session['language_id'] = LanguageRecord::getMainLanguageId();
     }
     $langValues = LanguageRecord::getLanguageValues($session['language_id']);
     $this->_label = Html::img('@web/images/flags/' . $langValues['acronym'] . '.gif', ['alt' => Yii::t('back', 'image - flag')]) . ' ' . $langValues['title'];
     $languages = LanguageRecord::getLanguages(true);
     foreach ($languages as $language) {
         /** @var LanguageRecord $language */
         $this->_items[] = ['label' => Html::img('@web/images/flags/' . $language->acronym . '.gif', ['alt' => Yii::t('back', 'image - flag')]) . ' ' . $language->title, 'url' => Yii::$app->urlManager->createUrl(['site/switch-language', 'id' => $language->id])];
     }
     Url::remember($this->routeBase);
 }