Commit 615effdc authored by Stairmaster's avatar Stairmaster Committed by Nicolas Widart

Add CSS classes to the menu items with children (#321)

* Added CSS classes to the menu items with children

* Remove whitespace at the end of lines
parent bdf2582e
...@@ -101,7 +101,16 @@ class MenuServiceProvider extends ServiceProvider ...@@ -101,7 +101,16 @@ class MenuServiceProvider extends ServiceProvider
public function addItemToMenu(Menuitem $item, Builder $menu) public function addItemToMenu(Menuitem $item, Builder $menu)
{ {
if ($this->hasChildren($item)) { if ($this->hasChildren($item)) {
$this->addChildrenToMenu($item->title, $item->items, $menu, ['icon' => $item->icon, 'target' => $item->target]); $this->addChildrenToMenu(
$item->title,
$item->items,
$menu,
[
'icon' => $item->icon,
'target' => $item->target,
'class' => $item->class,
]
);
} else { } else {
$target = $item->link_type != 'external' ? $item->locale . '/' . $item->uri : $item->url; $target = $item->link_type != 'external' ? $item->locale . '/' . $item->uri : $item->url;
$menu->url( $menu->url(
...@@ -191,4 +200,4 @@ class MenuServiceProvider extends ServiceProvider ...@@ -191,4 +200,4 @@ class MenuServiceProvider extends ServiceProvider
return "<?php echo MenuDirective::show([$arguments]); ?>"; return "<?php echo MenuDirective::show([$arguments]); ?>";
}); });
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment