2024-08-30 12:27:46 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @var array $menu
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
<ul class="list-unstyled components mb-5">
|
|
|
|
<?php foreach ($menu as $item):
|
2024-09-04 16:47:05 +03:00
|
|
|
$child = \kernel\services\MenuService::getChild($item->id);
|
2024-08-30 12:27:46 +03:00
|
|
|
if ($child): ?>
|
|
|
|
<li>
|
|
|
|
<a href="#item<?=$item->id?>" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle"><?= $item->label ?></a>
|
2024-09-04 16:47:05 +03:00
|
|
|
<ul class="collapse list-unstyled <?= \kernel\services\MenuService::hasActiveChild($item->id) ? "show" : "" ?>" id="item<?=$item->id?>">
|
2024-08-30 12:27:46 +03:00
|
|
|
<?php foreach ($child as $subitem): ?>
|
2024-09-06 11:47:11 +03:00
|
|
|
<li class="<?= \kernel\services\MenuService::isActive($subitem->url) ? "active" : "" ?>">
|
2024-08-30 12:27:46 +03:00
|
|
|
<a href="<?= $subitem->url ?>"><?= $subitem->label ?></a>
|
|
|
|
</li>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<?php else: ?>
|
2024-09-04 14:35:29 +03:00
|
|
|
<li class="<?= $item->url === \kernel\Request::getUrlPath() ? "active" : "" ?>">
|
2024-08-30 12:27:46 +03:00
|
|
|
<a href="<?= $item->url ?>"><?= $item->label ?></a>
|
|
|
|
</li>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
|
|
</ul>
|