Example #1
0
    public function renderItem(Item $item, $html = '')
    {
        $subItems = $item->getSubItems();
        $class = $item->isActive() ? 'active' : '';
        if (sizeof($subItems) > 0) {
            // Если первый уровень
            if (empty($html)) {
                $html .= '
					<li class="mm-dropdown mm-dropdown-root ' . $class . ' ">';
                $html .= '<a href="#">' . $this->renderIcon($item) . '<span class="mm-text">' . $item->getLabel() . '</span></a>';
                $html .= '<ul class="mmc-dropdown-delay animated fadeInLeft">';
            } else {
                $html .= '
					<li class="mm-dropdown"' . $class . '>';
                $html .= '<a tabindex="-1" href="#">' . $this->renderIcon($item) . ' <span class="mm-text">' . $item->getLabel() . '</span></a>';
                $html .= '<ul>';
            }
            foreach ($subItems as $key => $subItem) {
                $html .= $this->renderItem($subItem, ' ');
            }
            $html .= '</ul>
				</li>';
        } else {
            $html .= '<li class=' . $class . '>
						<a href="' . $item->getUrl() . '">' . $this->renderIcon($item) . ' <span class="mm-text">' . $item->getLabel() . '</span></a>
					</li>';
        }
        return $html;
    }