Browse Source

Frontend single language menu fix

master
Egorka 6 years ago
parent
commit
262a3fcf3f
  1. 12
      core/forms/menu/MenuItemForm.php

12
core/forms/menu/MenuItemForm.php

@ -37,12 +37,15 @@ class MenuItemForm extends LanguageDynamicModel
}
parent::__construct($menu, $attributes, $config);
if ($menu) {
foreach ( $menu->translations as $translate ) {
foreach ($menu->translations as $translate) {
if (!in_array($translate->language, $menu->translatedLanguages)) {
continue;
}
if ($translate->language == Yii::$app->params['backendDefaultLanguage']) {
$this->name = $translate->name;
$this->title_attr = $translate->title_attr;
}
else {
} else {
$this->{'name' . '_' . $translate->language} = $translate->name;
$this->{'title_attr' . '_' . $translate->language} = $translate->title_attr;
}
@ -64,7 +67,8 @@ class MenuItemForm extends LanguageDynamicModel
);
}
public function attributeLabels() {
public function attributeLabels()
{
return array_merge(
parent::attributeLabels(),
[

Loading…
Cancel
Save