-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnavigation.phtml
71 lines (71 loc) · 3.61 KB
/
navigation.phtml
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
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/* @var $container Zend\Navigation\Navigation */
$container = $this->container;
?>
<ul class="<?php echo $this->navigation($container)->menu()->getUlClass(); ?>">
<?php foreach ($container as $page): ?>
<?php if (!$this->navigation()->accept($page)) continue; ?>
<?php /* @var $page Zend\Navigation\Page\Mvc */ ?>
<?php $hasChildren = $page->hasPages() ?>
<?php if (!$hasChildren): ?>
<li<?php if ($page->isActive()) echo ' class="active"' ?>>
<a
class="nav-header"
href="<?php echo $page->getHref() ?>"
<?php if ($page->getTarget() != ""): ?>
target="<?php echo $page->getTarget(); ?>"
<?php endif; ?>
>
<?php if ($page->get("icon") !== ""): ?>
<span class="<?php echo $page->get("icon"); ?>"></span>
<?php endif; ?>
<?php echo $this->escapeHtml($this->translate($page->getLabel(), $this->navigation($container)->getTranslatorTextDomain())); ?>
</a>
</li>
<?php else: ?>
<?php
//check if access is allowed at least one item
$access = false;
foreach ($page->getPages() as $child) {
if ($this->navigation()->accept($child) && $child->get("separator") !== true) {
$access = true;
}
}
if ($access) :
?>
<li class="dropdown<?php if ($page->isActive(true)) echo ' active' ?>">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<?php if ($page->get("icon") !== ""): ?>
<span class="<?php echo $page->get("icon"); ?>"></span>
<?php endif; ?>
<?php echo $this->escapeHtml($this->translate($page->getLabel(),$this->navigation($container)->getTranslatorTextDomain())); ?>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<?php foreach ($page->getPages() as $child): ?>
<?php if (!$this->navigation()->accept($child)) continue; ?>
<?php if ($child->get("separator") === true): ?>
<li class="divider"></li>
<?php
continue;
endif;
?>
<li<?php if ($child->isActive()) echo ' class="active"' ?>>
<a
href="<?php echo $child->getHref() ?>"
<?php if ($child->getTarget() != ""): ?>
target="<?php echo $child->getTarget(); ?>"
<?php endif; ?> >
<?php if ($child->get("icon") !== ""): ?>
<span class="<?php echo $child->get("icon"); ?>"></span>
<?php endif; ?>
<?php echo $this->escapeHtml($this->translate($child->getLabel(),$this->navigation($container)->getTranslatorTextDomain())); ?>
</a>
</li>
<?php endforeach ?>
</ul>
</li>
<?php endif; ?>
<?php endif ?>
<?php endforeach ?>
</ul>