1. Christoffer Niska
  2. yii-bootstrap

Commits

Christoffer Niska  committed fe54a6b

Fixes some minor issues with BootMenu.

  • Participants
  • Parent commits 919e2d4
  • Branches nativejs

Comments (0)

Files changed (1)

File widgets/BootMenu.php

View file
 				echo '<li class="divider"></li>';
 			else
 			{
-				$options = isset($item['itemOptions']) ? $item['itemOptions'] : array();
-				$class = array();
+				$htmlOptions = isset($item['itemOptions']) ? $item['itemOptions'] : array();
+
+				$cssClass = '';
+
+				if ($item['active'])
+					$cssClass .= ' active';
 
 				if (isset($item['items']))
-					$class[] = 'dropdown';
+					$cssClass .= ' dropdown';
 
-				if ($item['active'])
-					$class[] = 'active';
+				if(isset($htmlOptions['class']))
+					$htmlOptions['class'] .= $cssClass;
+				else
+					$htmlOptions['class'] = $cssClass;
 
-				if($class !== array())
-				{
-					if(empty($options['class']))
-						$options['class'] = implode(' ',$class);
-					else
-						$options['class'] .= ' '.implode(' ',$class);
-				}
-
-				echo CHtml::openTag('li', $options);
+				echo CHtml::openTag('li', $htmlOptions);
 
 				$menu = $this->renderItem($item);
 
 	 */
 	protected function renderItem($item)
 	{
+		if (!isset($item['url']))
+			$item['url'] = '#';
+
 		if (isset($item['items']))
 		{
-			if (!isset($item['url']))
-				$item['url'] = '#';
-
 			if (isset($item['linkOptions']['class']))
 				$item['linkOptions']['class'] .= ' dropdown-toggle';
 			else
 			$item['linkOptions']['data-toggle'] = 'dropdown';
 		}
 
-		if (isset($item['url']))
-			return CHtml::link($item['label'], $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
-		else
-			return $item['label'];
+		return CHtml::link($item['label'], $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
 	}
 
 	/**