icingaweb2/application/layouts/scripts/parts/menu.phtml

34 lines
782 B
PHTML

<?php
if (! $this->level) {
$this->level = 0;
}
?>
<ul<?= $this->level === 0 ? ' role="navigation"' : '' ?>>
<?php
foreach ($this->items as $item) {
printf(
' <li%s><a href="%s">%s%s</a>',
$this->href($this->url) === $this->href($item->getUrl()) ? ' class="active"' : '',
$item->getUrl() ? $this->href($item->getUrl()) : '#',
$item->getIcon() ? $this->img(
$item->getIcon(),
array('class' => 'icon')
) . ' ' : '',
$this->escape($item->getTitle())
);
if ($item->hasChildren()) {
echo $this->partial(
'parts/menu.phtml',
array('items' => $item->getChildren(), 'url' => $this->url, 'level' => $this->level + 1)
);
}
echo "</li>\n";
}
?>
</ul>