From 824ce275f84dfc37b898bbb678304023c3b00e10 Mon Sep 17 00:00:00 2001 From: nikosid Date: Sat, 20 Oct 2018 11:39:12 +0200 Subject: [PATCH] Menu active condition fix. Code style correcting. PHPDoc filling misses. --- backend/views/layouts/base.php | 6 ++---- backend/views/layouts/clear.php | 3 ++- backend/views/layouts/common.php | 19 ++++++++++--------- backend/views/layouts/main.php | 3 ++- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/backend/views/layouts/base.php b/backend/views/layouts/base.php index 2858022c6..ee7f889ab 100755 --- a/backend/views/layouts/base.php +++ b/backend/views/layouts/base.php @@ -8,9 +8,7 @@ $bundle = BackendAsset::register($this); -$this->params['body-class'] = array_key_exists('body-class', $this->params) ? - $this->params['body-class'] - : null; +$this->params['body-class'] = $this->params['body-class'] ?? null; ?> beginPage() ?> @@ -39,4 +37,4 @@ endBody() ?> -endPage() ?> \ No newline at end of file +endPage() ?> diff --git a/backend/views/layouts/clear.php b/backend/views/layouts/clear.php index 3fd13d7a9..9bda1bd77 100755 --- a/backend/views/layouts/clear.php +++ b/backend/views/layouts/clear.php @@ -1,8 +1,9 @@ beginContent('@backend/views/layouts/common.php'); ?> -endContent(); ?> \ No newline at end of file +endContent(); ?> diff --git a/backend/views/layouts/common.php b/backend/views/layouts/common.php index ab2683964..2d28e0643 100644 --- a/backend/views/layouts/common.php +++ b/backend/views/layouts/common.php @@ -1,6 +1,6 @@ 'label' => Yii::t('backend', 'Users'), 'icon' => '', 'url' => ['/user/index'], - 'active' => (Yii::$app->controller->id == 'user'), + 'active' => Yii::$app->controller->id === 'user', 'visible' => Yii::$app->user->can('administrator'), ], [ @@ -165,26 +165,27 @@ class="img-circle"/> 'label' => Yii::t('backend', 'Static pages'), 'url' => ['/content/page/index'], 'icon' => '', - 'active' => (Yii::$app->controller->id == 'page'), + 'active' => Yii::$app->controller->id === 'page', ], [ 'label' => Yii::t('backend', 'Articles'), 'url' => '#', 'icon' => '', 'options' => ['class' => 'treeview'], - 'active' => (Yii::$app->controller->module->id == 'article'), + 'active' => 'content' === Yii::$app->controller->module->id && + ('article' === Yii::$app->controller->id || 'category' === Yii::$app->controller->id), 'items' => [ [ 'label' => Yii::t('backend', 'Articles'), 'url' => ['/content/article/index'], 'icon' => '', - 'active' => (Yii::$app->controller->id == 'default'), + 'active' => Yii::$app->controller->id === 'article', ], [ 'label' => Yii::t('backend', 'Categories'), 'url' => ['/content/category/index'], 'icon' => '', - 'active' => (Yii::$app->controller->id == 'category'), + 'active' => Yii::$app->controller->id === 'category', ], ], ], @@ -193,19 +194,19 @@ class="img-circle"/> 'url' => '#', 'icon' => '', 'options' => ['class' => 'treeview'], - 'active' => (Yii::$app->controller->module->id == 'widget'), + 'active' => Yii::$app->controller->module->id === 'widget', 'items' => [ [ 'label' => Yii::t('backend', 'Text Blocks'), 'url' => ['/widget/text/index'], 'icon' => '', - 'active' => (Yii::$app->controller->id == 'text'), + 'active' => Yii::$app->controller->id === 'text', ], [ 'label' => Yii::t('backend', 'Menu'), 'url' => ['/widget/menu/index'], 'icon' => '', - 'active' => (Yii::$app->controller->id == 'menu'), + 'active' => Yii::$app->controller->id === 'menu', ], [ 'label' => Yii::t('backend', 'Carousel'), diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php index c10940db8..950ab2d4c 100755 --- a/backend/views/layouts/main.php +++ b/backend/views/layouts/main.php @@ -1,6 +1,7 @@ beginContent('@backend/views/layouts/common.php'); ?> @@ -9,4 +10,4 @@ -endContent(); ?> \ No newline at end of file +endContent(); ?>