@@ -22,7 +22,7 @@ |
||
22 | 22 | * @param string $view |
23 | 23 | */ |
24 | 24 | function __construct(Container $container, $name, Attributes $attributes, |
25 | - Attributes $activeAttributes, $type = self::UL, $view = null); |
|
25 | + Attributes $activeAttributes, $type = self::UL, $view = null); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Make sub menu |
@@ -3,13 +3,21 @@ |
||
3 | 3 | <<?=$menu->getType() . $menu->buildAttributes();?>> |
4 | 4 | <?php foreach ($menu->all() as $element) :?> |
5 | 5 | <?php $isGroup = $element instanceof \Malezha\Menu\Contracts\Group;?> |
6 | - <?php if ($isGroup) $item = $element->getItem(); else $item = $element;?> |
|
6 | + <?php if ($isGroup) { |
|
7 | + $item = $element->getItem(); |
|
8 | +} else { |
|
9 | + $item = $element; |
|
10 | +} |
|
11 | +?> |
|
7 | 12 | <?php if ($item->canDisplay()) :?> |
8 | 13 | <li<?=$item->buildAttributes();?>> |
9 | 14 | <a href="<?=$item->getLink()->getUrl();?>"<?=$item->getLink()->buildAttributes();?>> |
10 | 15 | <?=$item->getLink()->getTitle();?> |
11 | 16 | </a> |
12 | - <?php if ($isGroup) echo $element->getMenu()->render($renderView);?> |
|
17 | + <?php if ($isGroup) { |
|
18 | + echo $element->getMenu()->render($renderView); |
|
19 | +} |
|
20 | +?> |
|
13 | 21 | </li> |
14 | 22 | <?php endif;?> |
15 | 23 | <?php endforeach;?> |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <div class="div-menu"> |
2 | 2 | <?php if ($menu) :?> |
3 | - <<?=$menu->getType() . $menu->buildAttributes();?>> |
|
3 | + <<?=$menu->getType() . $menu->buildAttributes(); ?>> |
|
4 | 4 | <?php foreach ($menu->all() as $element) :?> |
5 | - <?php $isGroup = $element instanceof \Malezha\Menu\Contracts\SubMenu;?> |
|
6 | - <?php if ($isGroup) $item = $element->getItem(); else $item = $element;?> |
|
5 | + <?php $isGroup = $element instanceof \Malezha\Menu\Contracts\SubMenu; ?> |
|
6 | + <?php if ($isGroup) $item = $element->getItem(); else $item = $element; ?> |
|
7 | 7 | <?php if ($item->canDisplay()) :?> |
8 | - <li<?=$item->buildAttributes();?>> |
|
9 | - <a href="<?=$item->getLink()->getUrl();?>"<?=$item->getLink()->buildAttributes();?>> |
|
10 | - <?=$item->getLink()->getTitle();?> |
|
8 | + <li<?=$item->buildAttributes(); ?>> |
|
9 | + <a href="<?=$item->getLink()->getUrl(); ?>"<?=$item->getLink()->buildAttributes(); ?>> |
|
10 | + <?=$item->getLink()->getTitle(); ?> |
|
11 | 11 | </a> |
12 | - <?php if ($isGroup) echo $element->getMenu()->render($renderView);?> |
|
12 | + <?php if ($isGroup) echo $element->getMenu()->render($renderView); ?> |
|
13 | 13 | </li> |
14 | - <?php endif;?> |
|
15 | - <?php endforeach;?> |
|
16 | - </<?=$menu->getType();?>> |
|
17 | - <?php endif;?> |
|
14 | + <?php endif; ?> |
|
15 | + <?php endforeach; ?> |
|
16 | + </<?=$menu->getType(); ?>> |
|
17 | + <?php endif; ?> |
|
18 | 18 | </div> |
19 | 19 | \ No newline at end of file |
@@ -103,7 +103,7 @@ |
||
103 | 103 | |
104 | 104 | protected function registerRenderSystem() |
105 | 105 | { |
106 | - $this->app->bind('menu.render', function (Container $app) { |
|
106 | + $this->app->bind('menu.render', function(Container $app) { |
|
107 | 107 | $config = $app['config']->get('menu'); |
108 | 108 | $key = $config['template-system']; |
109 | 109 | $available = $config['available-template-systems']; |
@@ -2,13 +2,21 @@ |
||
2 | 2 | <<?=$menu->getType() . $menu->buildAttributes();?>> |
3 | 3 | <?php foreach ($menu->all() as $element) :?> |
4 | 4 | <?php $isGroup = $element instanceof \Malezha\Menu\Contracts\Group;?> |
5 | - <?php if ($isGroup) $item = $element->getItem(); else $item = $element;?> |
|
5 | + <?php if ($isGroup) { |
|
6 | + $item = $element->getItem(); |
|
7 | +} else { |
|
8 | + $item = $element; |
|
9 | +} |
|
10 | +?> |
|
6 | 11 | <?php if ($item->canDisplay()) :?> |
7 | 12 | <li<?=$item->buildAttributes();?>> |
8 | 13 | <a href="<?=$item->getLink()->getUrl();?>"<?=$item->getLink()->buildAttributes();?>> |
9 | 14 | <?=$item->getLink()->getTitle();?> |
10 | 15 | </a> |
11 | - <?php if ($isGroup) echo $element->getMenu()->render($renderView);?> |
|
16 | + <?php if ($isGroup) { |
|
17 | + echo $element->getMenu()->render($renderView); |
|
18 | +} |
|
19 | +?> |
|
12 | 20 | </li> |
13 | 21 | <?php endif;?> |
14 | 22 | <?php endforeach;?> |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ($menu) :?> |
2 | - <<?=$menu->getType() . $menu->buildAttributes();?>> |
|
2 | + <<?=$menu->getType() . $menu->buildAttributes(); ?>> |
|
3 | 3 | <?php foreach ($menu->all() as $element) :?> |
4 | - <?php $isGroup = $element instanceof \Malezha\Menu\Contracts\SubMenu;?> |
|
5 | - <?php if ($isGroup) $item = $element->getItem(); else $item = $element;?> |
|
4 | + <?php $isGroup = $element instanceof \Malezha\Menu\Contracts\SubMenu; ?> |
|
5 | + <?php if ($isGroup) $item = $element->getItem(); else $item = $element; ?> |
|
6 | 6 | <?php if ($item->canDisplay()) :?> |
7 | - <li<?=$item->buildAttributes();?>> |
|
8 | - <a href="<?=$item->getLink()->getUrl();?>"<?=$item->getLink()->buildAttributes();?>> |
|
9 | - <?=$item->getLink()->getTitle();?> |
|
7 | + <li<?=$item->buildAttributes(); ?>> |
|
8 | + <a href="<?=$item->getLink()->getUrl(); ?>"<?=$item->getLink()->buildAttributes(); ?>> |
|
9 | + <?=$item->getLink()->getTitle(); ?> |
|
10 | 10 | </a> |
11 | - <?php if ($isGroup) echo $element->getMenu()->render($renderView);?> |
|
11 | + <?php if ($isGroup) echo $element->getMenu()->render($renderView); ?> |
|
12 | 12 | </li> |
13 | - <?php endif;?> |
|
14 | - <?php endforeach;?> |
|
15 | - </<?=$menu->getType();?>> |
|
16 | -<?php endif;?> |
|
17 | 13 | \ No newline at end of file |
14 | + <?php endif; ?> |
|
15 | + <?php endforeach; ?> |
|
16 | + </<?=$menu->getType(); ?>> |
|
17 | +<?php endif; ?> |
|
18 | 18 | \ No newline at end of file |
@@ -180,7 +180,7 @@ |
||
180 | 180 | |
181 | 181 | $builder = $this->builderFactory(); |
182 | 182 | $builder->create('index', 'Index Page', url('/')); |
183 | - $builder->submenu('group', function(Item $item){}, function(Builder $menu) { |
|
183 | + $builder->submenu('group', function(Item $item) {}, function(Builder $menu) { |
|
184 | 184 | $menu->create('one', 'One', url('/one')); |
185 | 185 | }); |
186 | 186 |