1. DJ Verlinden
  2. yii-bootstrap

Commits

Christoffer Niska  committed ad6cf7a

added bottom navbar support to BootNavbar

  • Participants
  • Parent commits c237377
  • Branches 1.0.0-wip

Comments (0)

Files changed (1)

File widgets/BootNavbar.php

View file
  */
 class BootNavbar extends BootWidget
 {
+	// Navbar fix locations.
+	const FIXED_TOP = 'top';
+	const FIXED_BOTTOM = 'bottom';
+
 	/**
 	 * @var string the text for the brand.
 	 */
 	 */
 	public $items = array();
 	/**
-	 * @var boolean whether the nav span over the full width. Defaults to false.
+	 * @var string fix location of the navbar if applicable. Valid values are 'top' and 'bottom'. Defaults to 'top'.
 	 * @since 0.9.8
 	 */
+	public $fixed = self::FIXED_TOP;
+	/**
+	* @var boolean whether the nav span over the full width. Defaults to false.
+	* @since 0.9.8
+	*/
 	public $fluid = false;
 	/**
-	 * @var boolean whether the nav bar is fixed to the top of the page. Defaults to true.
-	 * @since 0.9.8
-	 */
-	public $fixed = true;
-	/**
 	 * @var boolean whether to enable collapsing on narrow screens. Default to false.
 	 */
 	public $collapse = false;
 	 */
 	public function run()
 	{
+		$class = array('navbar');
+
+		$validFixes = array(self::FIXED_TOP, self::FIXED_BOTTOM);
+
+		if (in_array($this->fixed, $validFixes))
+			$class[] = 'navbar-fixed-'.$this->fixed;
+
+		$cssClass = implode(' ', $class);
 		if (isset($this->htmlOptions['class']))
-			$this->htmlOptions['class'] .= ' navbar';
+			$this->htmlOptions['class'] .= ' '.$cssClass;
 		else
-			$this->htmlOptions['class'] = 'navbar';
-
-		if ($this->fixed)
-			$this->htmlOptions['class'] .= ' navbar-fixed-top';
-		else
-			$this->htmlOptions['class'] .= ' navbar-static';
+			$this->htmlOptions['class'] = $cssClass;
 
 		if (isset($this->brandOptions['class']))
 			$this->brandOptions['class'] .= ' brand';