Commits

Christoffer Niska committed cff8e4f

refactored some code in BootNavbar

Comments (0)

Files changed (1)

widgets/BootNavbar.php

 
 			if (!isset($this->brandUrl))
 				$this->brandUrl = Yii::app()->homeUrl;
+
+			$this->brandOptions['href'] = $this->brandUrl;
+
+			if (isset($this->brandOptions['class']))
+				$this->brandOptions['class'] .= ' brand';
+			else
+				$this->brandOptions['class'] = 'brand';
 		}
-	}
 
-	/**
-	 * Runs the widget.
-	 */
-	public function run()
-	{
 		$classes = array('navbar');
 
 		if ($this->fixed !== false)
 			$this->htmlOptions['class'] .= ' '.$classes;
 		else
 			$this->htmlOptions['class'] = $classes;
+	}
 
-		if (isset($this->brandOptions['class']))
-			$this->brandOptions['class'] .= ' brand';
-		else
-			$this->brandOptions['class'] = 'brand';
-
-		if (isset($this->brandUrl))
-			$this->brandOptions['href'] = $this->brandUrl;
-
+	/**
+	 * Runs the widget.
+	 */
+	public function run()
+	{
 		$containerCssClass = $this->fluid ? 'container-fluid' : 'container';
 
 		echo CHtml::openTag('div', $this->htmlOptions);