Browse Source

Fixes #4595: more consistend use of "false" in "don't use" case

tags/2.0.0-rc
Alexander Makarov 10 years ago
parent
commit
9d72ead183
  1. 3
      CHANGELOG.md
  2. 15
      NavBar.php

3
CHANGELOG.md

@ -8,9 +8,10 @@ Yii Framework 2 bootstrap extension Change Log
- Bug #3740: Fixed duplicate error message when client validation is enabled (tadaszelvys) - Bug #3740: Fixed duplicate error message when client validation is enabled (tadaszelvys)
- Bug #3749: Fixed invalid plugin registration and ensure clickable links in dropdown (kartik-v) - Bug #3749: Fixed invalid plugin registration and ensure clickable links in dropdown (kartik-v)
- Enh #4024: Added ability to `yii\bootstrap\Tabs` to encode each `Tabs::items['label']` separately (creocoder, umneeq) - Enh #4024: Added ability to `yii\bootstrap\Tabs` to encode each `Tabs::items['label']` separately (creocoder, umneeq)
- Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue)
- Enh #4120: Added ability for each item to choose it's encoding option in `Dropdown` and `Nav` (Alex-Code) - Enh #4120: Added ability for each item to choose it's encoding option in `Dropdown` and `Nav` (Alex-Code)
- Enh #4363: Added `showIndicators` property to make Carousel indicators optional (sdkiller) - Enh #4363: Added `showIndicators` property to make Carousel indicators optional (sdkiller)
- Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue)
- Chg #4595: `yii\bootstrap\NavBar`'s `brandLabel` and `brandUrl` are taking `false` instead of `null` for "don't use" case (samdark)
2.0.0-beta April 13, 2014 2.0.0-beta April 13, 2014
------------------------- -------------------------

15
NavBar.php

@ -56,15 +56,16 @@ class NavBar extends Widget
*/ */
public $containerOptions = []; public $containerOptions = [];
/** /**
* @var string the text of the brand. Note that this is not HTML-encoded. * @var string|boolean the text of the brand of false if it's not used. Note that this is not HTML-encoded.
* @see http://getbootstrap.com/components/#navbar * @see http://getbootstrap.com/components/#navbar
*/ */
public $brandLabel; public $brandLabel = false;
/** /**
* @param array|string $url the URL for the brand's hyperlink tag. This parameter will be processed by [[Url::to()]] * @param array|string|boolean $url the URL for the brand's hyperlink tag. This parameter will be processed by [[Url::to()]]
* and will be used for the "href" attribute of the brand link. If not set, [[\yii\web\Application::homeUrl]] will be used. * and will be used for the "href" attribute of the brand link. Default value is false that means
* [[\yii\web\Application::homeUrl]] will be used.
*/ */
public $brandUrl; public $brandUrl = false;
/** /**
* @var array the HTML attributes of the brand link. * @var array the HTML attributes of the brand link.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
@ -115,9 +116,9 @@ class NavBar extends Widget
$this->containerOptions['id'] = "{$this->options['id']}-collapse"; $this->containerOptions['id'] = "{$this->options['id']}-collapse";
} }
echo $this->renderToggleButton(); echo $this->renderToggleButton();
if ($this->brandLabel !== null) { if ($this->brandLabel !== false) {
Html::addCssClass($this->brandOptions, 'navbar-brand'); Html::addCssClass($this->brandOptions, 'navbar-brand');
echo Html::a($this->brandLabel, $this->brandUrl === null ? Yii::$app->homeUrl : $this->brandUrl, $this->brandOptions); echo Html::a($this->brandLabel, $this->brandUrl === false ? Yii::$app->homeUrl : $this->brandUrl, $this->brandOptions);
} }
echo Html::endTag('div'); echo Html::endTag('div');
Html::addCssClass($this->containerOptions, 'collapse'); Html::addCssClass($this->containerOptions, 'collapse');

Loading…
Cancel
Save