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;
    }
Example #2
0
    /**
     * Рендерит один пункт меню
     * @param  Item   $item [description]
     * @return [type]       [description]
     */
    public function renderItem(Item $item)
    {
        $subItems = $item->getSubItems();
        if (sizeof($subItems) > 0) {
            $html = '<li class="dropdown">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $this->renderIcon($item) . ' ' . $item->getLabel() . '</a>
							<ul class="dropdown-menu">';
            foreach ($subItems as $subItem) {
                $html .= '<li><a href="' . $subItem->getUrl() . '">' . $this->renderIcon($item) . '<span class="mm-text">' . $subItem->getLabel() . '</span></a></li>';
            }
            $html .= '</ul>
					</li>';
        } else {
            $html = '<li>
						<a href="' . $item->getUrl() . '">' . $this->renderIcon($item) . ' <span class="mm-text">' . $item->getLabel() . '</span></a>
					</li>';
        }
        return $html;
    }
Example #3
0
 /**
  * Возвращает массив вложенных подпунктов
  * @return array
  */
 public function getSubItems(Item $item)
 {
     return $item->getSubItems();
 }