/** * @return string */ protected function getMenu() { if (null === $this->menu) { return ''; } $html = ''; foreach ($this->menu->items() as $item) { if (!$item->hasAccess()) { continue; } if ($item instanceof Group) { $html .= $this->renderTreeview($item); } else { $html .= $this->renderItem($item); } } return $html; }
/** * Render the given menu and put it to the right if needed * * @param Menu $menu * @param bool $onTheRight * * @return string */ protected function renderMenu(Menu $menu = null, $onTheRight = false) { if (null === $menu) { return ''; } $html = ''; $template = ' <ul class="nav navbar-nav %s"> %s </ul> '; foreach ($menu->items() as $item) { if (!$item->hasAccess()) { continue; } if ($item instanceof Separator) { $html .= $this->renderSeparator(); } elseif ($item instanceof Group) { $html .= $this->renderDropdown($item); } else { $html .= $this->renderItem($item); } } return vsprintf($template, [$onTheRight ? 'navbar-right' : '', $html]); }