| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -8,7 +8,7 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					namespace yii\bootstrap; | 
					 | 
					 | 
					 | 
					namespace yii\bootstrap; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use yii\base\InvalidConfigException; | 
					 | 
					 | 
					 | 
					use yii\base\InvalidConfigException; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use yii\helpers\base\ArrayHelper; | 
					 | 
					 | 
					 | 
					use yii\helpers\ArrayHelper; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use yii\helpers\Html; | 
					 | 
					 | 
					 | 
					use yii\helpers\Html; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/** | 
					 | 
					 | 
					 | 
					/** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -22,12 +22,12 @@ use yii\helpers\Html; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *         array( | 
					 | 
					 | 
					 | 
					 *         array( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *             'label' => 'Home', | 
					 | 
					 | 
					 | 
					 *             'label' => 'Home', | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *             'url' => '/', | 
					 | 
					 | 
					 | 
					 *             'url' => '/', | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *             'options' => array(...), | 
					 | 
					 | 
					 | 
					 *             'linkOptions' => array(...), | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *             'active' => true, | 
					 | 
					 | 
					 | 
					 *             'active' => true, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *         ), | 
					 | 
					 | 
					 | 
					 *         ), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *         array( | 
					 | 
					 | 
					 | 
					 *         array( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *             'label' => 'Dropdown', | 
					 | 
					 | 
					 | 
					 *             'label' => 'Dropdown', | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *             'dropdown' => array( | 
					 | 
					 | 
					 | 
					 *             'items' => array( | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *                  array( | 
					 | 
					 | 
					 | 
					 *                  array( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *                      'label' => 'DropdownA', | 
					 | 
					 | 
					 | 
					 *                      'label' => 'DropdownA', | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 *                      'url' => '#', | 
					 | 
					 | 
					 | 
					 *                      'url' => '#', | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -52,26 +52,25 @@ class Nav extends Widget | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * @var array list of items in the nav widget. Each array element represents a single | 
					 | 
					 | 
					 | 
						 * @var array list of items in the nav widget. Each array element represents a single | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * menu item with the following structure: | 
					 | 
					 | 
					 | 
						 * menu item with the following structure: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * | 
					 | 
					 | 
					 | 
						 * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * ```php | 
					 | 
					 | 
					 | 
						 * - label: string, required, the nav item label. | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * array( | 
					 | 
					 | 
					 | 
						 * - url: optional, the item's URL. Defaults to "#". | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     // required, the menu item label. | 
					 | 
					 | 
					 | 
						 * - linkOptions: array, optional, the HTML attributes of the item's link. | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     'label' => 'Nav item label', | 
					 | 
					 | 
					 | 
						 * - options: array, optional, the HTML attributes of the item container (LI). | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     // optional, the URL of the menu item. Defaults to "#" | 
					 | 
					 | 
					 | 
						 * - active: boolean, optional, whether the item should be on active state or not. | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     'url'=> '#', | 
					 | 
					 | 
					 | 
						 * - items: array, optional, the configuration of specify the item's dropdown menu. You can optionally set this as | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     // optional, the HTML options of the URL. | 
					 | 
					 | 
					 | 
						 *   a string (ie. `'items'=> Dropdown::widget(array(...))` | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     'urlOptions' => array(...), | 
					 | 
					 | 
					 | 
						 *   - important: there is an issue with sub-dropdown menus, and as of 3.0, bootstrap won't support sub-dropdown. | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     // optional the HTML attributes of the item container (LI). | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     'options' => array(...), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     // optional, an array of [[Dropdown]] widget items so to display a dropdown menu on the tab header. | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     // important: there is an issue with sub-dropdown menus, and as of 3.0, bootstrap won't support sub-dropdown | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     // @see https://github.com/twitter/bootstrap/issues/5050#issuecomment-11741727 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 *     'dropdown'=> array(...) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * ``` | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * | 
					 | 
					 | 
					 | 
						 * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 * Optionally, you can also use a plain string instead of an array element. | 
					 | 
					 | 
					 | 
						 * **Note:** Optionally, you can also use a plain string instead of an array element. | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @see https://github.com/twitter/bootstrap/issues/5050#issuecomment-11741727 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @see [[Dropdown]] | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 */ | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						public $items = array(); | 
					 | 
					 | 
					 | 
						public $items = array(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 * @var boolean whether the nav items labels should be HTML-encoded. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						public $encodeLabels = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -79,6 +78,7 @@ class Nav extends Widget | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						 */ | 
					 | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						public function init() | 
					 | 
					 | 
					 | 
						public function init() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						{ | 
					 | 
					 | 
					 | 
						{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							parent::init(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$this->addCssClass($this->options, 'nav'); | 
					 | 
					 | 
					 | 
							$this->addCssClass($this->options, 'nav'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -88,6 +88,7 @@ class Nav extends Widget | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						public function run() | 
					 | 
					 | 
					 | 
						public function run() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						{ | 
					 | 
					 | 
					 | 
						{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							echo $this->renderItems(); | 
					 | 
					 | 
					 | 
							echo $this->renderItems(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							$this->registerPlugin('dropdown'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** | 
					 | 
					 | 
					 | 
						/** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -117,21 +118,26 @@ class Nav extends Widget | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if (!isset($item['label'])) { | 
					 | 
					 | 
					 | 
							if (!isset($item['label'])) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								throw new InvalidConfigException("The 'label' option is required."); | 
					 | 
					 | 
					 | 
								throw new InvalidConfigException("The 'label' option is required."); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$label = $item['label']; | 
					 | 
					 | 
					 | 
							$label = $this->encodeLabels ? Html::encode($item['label']) : $item['label']; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$url = ArrayHelper::getValue($item, 'url', '#'); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$options = ArrayHelper::getValue($item, 'options', array()); | 
					 | 
					 | 
					 | 
							$options = ArrayHelper::getValue($item, 'options', array()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$urlOptions = ArrayHelper::getValue($item, 'urlOptions', array()); | 
					 | 
					 | 
					 | 
							$dropdown = ArrayHelper::getValue($item, 'items'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$dropdown = null; | 
					 | 
					 | 
					 | 
							$url = Html::url(ArrayHelper::getValue($item, 'url', '#')); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							$linkOptions = ArrayHelper::getValue($item, 'linkOptions', array()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if(ArrayHelper::getValue($item, 'active')) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								$this->addCssClass($options, 'active'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							// does it has a dropdown widget? | 
					 | 
					 | 
					 | 
							if ($dropdown !== null) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if (isset($item['dropdown'])) { | 
					 | 
					 | 
					 | 
								$linkOptions['data-toggle'] = 'dropdown'; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								$urlOptions['data-toggle'] = 'dropdown'; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								$this->addCssClass($options, 'dropdown'); | 
					 | 
					 | 
					 | 
								$this->addCssClass($options, 'dropdown'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								$this->addCssClass($urlOptions, 'dropdown-toggle'); | 
					 | 
					 | 
					 | 
								$this->addCssClass($urlOptions, 'dropdown-toggle'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								$label .= ' ' . Html::tag('b', '', array('class' => 'caret')); | 
					 | 
					 | 
					 | 
								$label .= ' ' . Html::tag('b', '', array('class' => 'caret')); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								$dropdown = Dropdown::widget(array('items' => $item['dropdown'], 'clientOptions' => false)); | 
					 | 
					 | 
					 | 
								$dropdown = is_string($dropdown) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									? $dropdown | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									: Dropdown::widget(array('items' => $item['items'], 'clientOptions' => false)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							return Html::tag('li', Html::a($label, $url, $urlOptions) . $dropdown, $options); | 
					 | 
					 | 
					 | 
							return Html::tag('li', Html::a($label, $url, $linkOptions) . $dropdown, $options); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} |