public function behaviors() { return ArrayHelper::merge(parent::behaviors(), ['ml' => ['class' => MultilingualBehavior::className(), 'languages' => Languages::getAllowedLanguages(), 'defaultLanguage' => Languages::getDefaultLanguage(), 'langForeignKey' => 'item_id', 'tableName' => "{{%" . $this->tableName() . "Lang}}", 'attributes' => $this->multiLangAttributes]]); }
<?php use yii\helpers\Url; /** * @var $items * */ if (isset($items) and $items) { ?> <li class="dropdown menu-merge"> <div class="navbar-btn btn-group"> <?php echo \yii\helpers\Html::button(\app\modules\languages\Languages::getLanguageNameByCode(Yii::$app->language), ['data-toggle' => 'dropdown', 'class' => 'btn btn-sm dropdown-toggle']); ?> <ul class="dropdown-menu pv5" role="menu"> <?php foreach ($items as $item) { ?> <li> <?php echo \yii\helpers\Html::a(\app\modules\languages\Languages::getLanguageNameByCode(\yii\helpers\ArrayHelper::getValue($item, 'code')), Url::to($item['url'])); ?> </li> <?php } ?> </ul> </div> </li> <?php }