/**
  * Return the opening markup for the given navigation item
  *
  * @param   NavigationItem  $item
  *
  * @return  string
  */
 public function beginItemMarkup(NavigationItem $item)
 {
     $cssClass = array(static::CSS_CLASS_ITEM);
     if ($item->hasChildren() && $item->getChildren()->getLayout() === Navigation::LAYOUT_DROPDOWN) {
         $cssClass[] = static::CSS_CLASS_DROPDOWN;
         $item->setAttribute('class', static::CSS_CLASS_DROPDOWN_TOGGLE)->setIcon(static::DROPDOWN_TOGGLE_ICON)->setUrl('#');
     }
     if ($item->getActive()) {
         $cssClass[] = static::CSS_CLASS_ACTIVE;
     }
     $content = sprintf('<li id="%s" class="%s">', $this->view()->escape($item->getUniqueName()), join(' ', $cssClass));
     return $content;
 }
Пример #2
0
 /**
  * Return the opening markup for the given navigation item
  *
  * @param   NavigationItem  $item
  *
  * @return  string
  */
 public function beginItemMarkup(NavigationItem $item)
 {
     $cssClasses = array(static::CSS_CLASS_ITEM);
     if ($item->hasChildren() && $item->getChildren()->getLayout() === Navigation::LAYOUT_DROPDOWN) {
         $cssClasses[] = static::CSS_CLASS_DROPDOWN;
         $item->setAttribute('class', static::CSS_CLASS_DROPDOWN_TOGGLE)->setIcon(static::DROPDOWN_TOGGLE_ICON)->setUrl('#');
     }
     if ($item->getActive()) {
         $cssClasses[] = static::CSS_CLASS_ACTIVE;
     }
     if ($item->getIcon() === null) {
         // @TODO(el): Add constant
         $cssClasses[] = 'no-icon';
     }
     if ($cssClass = $item->getCssClass()) {
         $cssClasses[] = $cssClass;
     }
     $content = sprintf('<li class="%s">', join(' ', $cssClasses));
     return $content;
 }