_category_menu.php
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
use artbox\catalog\models\Category;
use yii\bootstrap\Html;
use yii\web\View;
/**
* @var View $this
* @var bool $isHome
* @var Category[] $categories
*/
?>
<ul class="dropdown-menu sidebar" role="menu" aria-labelledby="dLabel" <?php echo $isHome ? 'id="home-category-anchor"' : ''; ?>>
<?php
foreach ($categories as $category) {
if ($category->lang->alias) {
?>
<li class="dropdown-submenu <?=empty($category->categories) ? 'no-child-menu' : ''?>">
<?php
echo Html::a(
$category->lang->title,
[
'category/view',
'category' => $category->lang->alias->value,
],
[
'tabindex' => -1,
]
);
if (!empty($category->categories)) {
?>
<ul class="dropdown-menu">
<?php
foreach ($category->categories as $childCategory) {
if ($childCategory->lang->alias) {
echo Html::tag(
'li',
Html::a(
$childCategory->lang->title,
[
'category/view',
'category' => $childCategory->lang->alias->value,
]
)
);
}
}
?>
</ul>
<?php
}
?>
</li>
<?php
}
}
?>
</ul>