Skip to content

Commit 824ce27

Browse files
committed
Menu active condition fix.
Code style correcting. PHPDoc filling misses.
1 parent c89d40b commit 824ce27

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

backend/views/layouts/base.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
$bundle = BackendAsset::register($this);
1010

11-
$this->params['body-class'] = array_key_exists('body-class', $this->params) ?
12-
$this->params['body-class']
13-
: null;
11+
$this->params['body-class'] = $this->params['body-class'] ?? null;
1412
?>
1513

1614
<?php $this->beginPage() ?>
@@ -39,4 +37,4 @@
3937
<?php $this->endBody() ?>
4038
<?php echo Html::endTag('body') ?>
4139
</html>
42-
<?php $this->endPage() ?>
40+
<?php $this->endPage() ?>

backend/views/layouts/clear.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22
/**
33
* @var $this yii\web\View
4+
* @var $content string
45
*/
56
?>
67
<?php $this->beginContent('@backend/views/layouts/common.php'); ?>
78
<?php echo $content ?>
8-
<?php $this->endContent(); ?>
9+
<?php $this->endContent(); ?>

backend/views/layouts/common.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* @var $this yii\web\View
3+
* @var $this yii\web\View
44
* @var $content string
55
*/
66

@@ -154,7 +154,7 @@ class="img-circle"/>
154154
'label' => Yii::t('backend', 'Users'),
155155
'icon' => '<i class="fa fa-users"></i>',
156156
'url' => ['/user/index'],
157-
'active' => (Yii::$app->controller->id == 'user'),
157+
'active' => Yii::$app->controller->id === 'user',
158158
'visible' => Yii::$app->user->can('administrator'),
159159
],
160160
[
@@ -165,26 +165,27 @@ class="img-circle"/>
165165
'label' => Yii::t('backend', 'Static pages'),
166166
'url' => ['/content/page/index'],
167167
'icon' => '<i class="fa fa-thumb-tack"></i>',
168-
'active' => (Yii::$app->controller->id == 'page'),
168+
'active' => Yii::$app->controller->id === 'page',
169169
],
170170
[
171171
'label' => Yii::t('backend', 'Articles'),
172172
'url' => '#',
173173
'icon' => '<i class="fa fa-files-o"></i>',
174174
'options' => ['class' => 'treeview'],
175-
'active' => (Yii::$app->controller->module->id == 'article'),
175+
'active' => 'content' === Yii::$app->controller->module->id &&
176+
('article' === Yii::$app->controller->id || 'category' === Yii::$app->controller->id),
176177
'items' => [
177178
[
178179
'label' => Yii::t('backend', 'Articles'),
179180
'url' => ['/content/article/index'],
180181
'icon' => '<i class="fa fa-file-o"></i>',
181-
'active' => (Yii::$app->controller->id == 'default'),
182+
'active' => Yii::$app->controller->id === 'article',
182183
],
183184
[
184185
'label' => Yii::t('backend', 'Categories'),
185186
'url' => ['/content/category/index'],
186187
'icon' => '<i class="fa fa-folder-open-o"></i>',
187-
'active' => (Yii::$app->controller->id == 'category'),
188+
'active' => Yii::$app->controller->id === 'category',
188189
],
189190
],
190191
],
@@ -193,19 +194,19 @@ class="img-circle"/>
193194
'url' => '#',
194195
'icon' => '<i class="fa fa-code"></i>',
195196
'options' => ['class' => 'treeview'],
196-
'active' => (Yii::$app->controller->module->id == 'widget'),
197+
'active' => Yii::$app->controller->module->id === 'widget',
197198
'items' => [
198199
[
199200
'label' => Yii::t('backend', 'Text Blocks'),
200201
'url' => ['/widget/text/index'],
201202
'icon' => '<i class="fa fa-circle-o"></i>',
202-
'active' => (Yii::$app->controller->id == 'text'),
203+
'active' => Yii::$app->controller->id === 'text',
203204
],
204205
[
205206
'label' => Yii::t('backend', 'Menu'),
206207
'url' => ['/widget/menu/index'],
207208
'icon' => '<i class="fa fa-circle-o"></i>',
208-
'active' => (Yii::$app->controller->id == 'menu'),
209+
'active' => Yii::$app->controller->id === 'menu',
209210
],
210211
[
211212
'label' => Yii::t('backend', 'Carousel'),

backend/views/layouts/main.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @var $this yii\web\View
4+
* @var $content string
45
*/
56
?>
67
<?php $this->beginContent('@backend/views/layouts/common.php'); ?>
@@ -9,4 +10,4 @@
910
<?php echo $content ?>
1011
</div>
1112
</div>
12-
<?php $this->endContent(); ?>
13+
<?php $this->endContent(); ?>

0 commit comments

Comments
 (0)