Beispiel #1
0
 /**
  * Normalizes the {@link items} property so that the 'active' state is properly identified for every menu item.
  * @param array $items the items to be normalized.
  * @param string $route the route of the current request.
  * @param boolean $active whether there is an active child menu item.
  * @return array the normalized menu items
  */
 protected function normalizeItems($items, $route, &$active)
 {
     foreach ($items as $i => $item) {
         if (!is_array($item)) {
             $item = array('divider' => true);
         } else {
             if (!isset($item['itemOptions'])) {
                 $item['itemOptions'] = array();
             }
             $classes = array();
             if (!isset($item['url']) && !isset($item['items']) && $this->isVertical()) {
                 $item['header'] = true;
                 $classes[] = 'nav-header';
             }
             if (!empty($classes)) {
                 $classes = implode($classes, ' ');
                 if (isset($item['itemOptions']['class'])) {
                     $item['itemOptions']['class'] .= ' ' . $classes;
                 } else {
                     $item['itemOptions']['class'] = $classes;
                 }
             }
         }
         $items[$i] = $item;
     }
     return parent::normalizeItems($items, $route, $active);
 }
 protected function normalizeItems($items, $route, &$active)
 {
     $route = $this->route ? $this->route : $route;
     return parent::normalizeItems($items, $route, $active);
 }