Ejemplo n.º 1
0
 /**
  * @param ItemInterface $item
  * @param array         $options
  */
 protected function renderRootElement(ItemInterface $item, array $options = [])
 {
     $class = explode(' ', $item->getChildrenAttribute('class', ''));
     $class[] = 'sidebar-menu';
     $item->setChildrenAttribute('class', implode(' ', $class));
     // add base class
 }
Ejemplo n.º 2
0
 public function render(ItemInterface $item, array $options = array())
 {
     $options = array_merge(array('currentClass' => 'active'), $options);
     if ($item->isRoot()) {
         $item->setChildrenAttribute('class', trim('nav navbar-nav ' . $item->getChildrenAttribute('class')));
     }
     return parent::render($item, $options);
 }
Ejemplo n.º 3
0
 /**
  * Build an item based on options
  * @param ItemInterface $item
  * @param array         $options
  */
 public function buildItem(ItemInterface $item, array $options)
 {
     if ($options['navbar']) {
         $item->setChildrenAttribute('class', 'nav navbar-nav');
     }
     if ($options['pills']) {
         $item->setChildrenAttribute('class', 'nav nav-pills');
     }
     if ($options['stacked']) {
         $class = $item->getChildrenAttribute('class');
         $item->setChildrenAttribute('class', $class . ' nav-stacked');
     }
     if ($options['dropdown-header']) {
         $item->setAttribute('role', 'presentation')->setAttribute('class', 'dropdown-header')->setUri(null);
     }
     if ($options['list-group']) {
         //echo "BLUBBB";
         $item->setChildrenAttribute('class', 'list-group');
         $item->setAttribute('class', 'list-group-item');
     }
     //var_dump($item->getLabel(), $item->getChildrenAttributes());
     if ($options['list-group-item']) {
         $item->setAttribute('class', 'list-group-item');
     }
     if ($options['dropdown']) {
         $item->setUri('#')->setAttribute('class', 'dropdown')->setLinkAttribute('class', 'dropdown-toggle')->setLinkAttribute('data-toggle', 'dropdown')->setChildrenAttribute('class', 'dropdown-menu')->setChildrenAttribute('role', 'menu');
         if ($options['caret']) {
             $item->setExtra('caret', 'true');
         }
     }
     if ($options['divider']) {
         $item->setLabel('')->setUri(null)->setAttribute('role', 'presentation')->setAttribute('class', 'divider');
     }
     if ($options['pull-right']) {
         $class = $item->getChildrenAttribute('class', '');
         $item->setChildrenAttribute('class', $class . ' pull-right');
     }
     if ($options['icon']) {
         $item->setExtra('icon', $options['icon']);
     }
 }