Commit b1e20900 by Alexander Makarov

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

parent da0cf6c3
......@@ -8,9 +8,10 @@ Yii Framework 2 bootstrap extension Change Log
- 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)
- 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 #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
-------------------------
......
......@@ -56,15 +56,16 @@ class NavBar extends Widget
*/
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
*/
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()]]
* and will be used for the "href" attribute of the brand link. If not set, [[\yii\web\Application::homeUrl]] will be used.
* @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. 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.
* @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";
}
echo $this->renderToggleButton();
if ($this->brandLabel !== null) {
if ($this->brandLabel !== false) {
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');
Html::addCssClass($this->containerOptions, 'collapse');
......
......@@ -219,6 +219,7 @@ Yii Framework 2 Change Log
- Chg #4318: `yii\helpers\Html::ul()` and `ol()` will return an empty list tag if an empty item array is given (qiangxue)
- Chg #4331: `yii\helpers\Url` now uses `UrlManager` to determine base URL when generating URLs (qiangxue)
- Chg #4591: `yii\helpers\Url::to()` will no longer prefix relative URLs with the base URL (qiangxue)
- Chg #4595: `yii\widgets\LinkPager`'s `nextPageLabel`, `prevPageLabel`, `firstPageLabel`, `lastPageLabel` are now taking `false` instead of `null` for "no label" (samdark)
- Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue)
- Chg: Added `$user` as the first parameter of `yii\rbac\Rule::execute()` (qiangxue)
- Chg: `yii\grid\DataColumn::getDataCellValue()` visibility is now `public` to allow accessing the value from a GridView directly (cebe)
......
......@@ -180,4 +180,7 @@ new ones save the following code as `convert.php` that should be placed in the s
* [[yii\helpers\Url::to()]] will no longer prefix base URL to relative URLs. For example, `Url::to('images/logo.png')`
will return `images/logo.png` directly. If you want a relative URL to be prefix with base URL, you should make use
of the alias `@web`. For example, `Url::to('@web/images/logo.png')` will return `/BaseUrl/images/logo.png`.
* `yii\bootstrap\NavBar`'s `brandLabel` and `brandUrl` are taking `false` instead of `null` for "don't use" case.
* `yii\widgets\LinkPager`'s `nextPageLabel`, `prevPageLabel`, `firstPageLabel`, `lastPageLabel` are now taking `false` instead of `null` for "no label".
......@@ -72,25 +72,25 @@ class LinkPager extends Widget
*/
public $maxButtonCount = 10;
/**
* @var string the label for the "next" page button. Note that this will NOT be HTML-encoded.
* If this property is null, the "next" page button will not be displayed.
* @var string|boolean the label for the "next" page button. Note that this will NOT be HTML-encoded.
* If this property is false, the "next" page button will not be displayed.
*/
public $nextPageLabel = '»';
/**
* @var string the text label for the previous page button. Note that this will NOT be HTML-encoded.
* If this property is null, the "previous" page button will not be displayed.
* @var string|boolean the text label for the previous page button. Note that this will NOT be HTML-encoded.
* If this property is false, the "previous" page button will not be displayed.
*/
public $prevPageLabel = '«';
/**
* @var string the text label for the "first" page button. Note that this will NOT be HTML-encoded.
* If this property is null, the "first" page button will not be displayed.
* @var string|boolean the text label for the "first" page button. Note that this will NOT be HTML-encoded.
* Default is false that means the "first" page button will not be displayed.
*/
public $firstPageLabel;
public $firstPageLabel = false;
/**
* @var string the text label for the "last" page button. Note that this will NOT be HTML-encoded.
* If this property is null, the "last" page button will not be displayed.
* @var string|boolean the text label for the "last" page button. Note that this will NOT be HTML-encoded.
* Default is false that means the "last" page button will not be displayed.
*/
public $lastPageLabel;
public $lastPageLabel = false;
/**
* @var boolean whether to register link tags in the HTML header for prev, next, first and last page.
* Defaults to `false` to avoid conflicts when multiple pagers are used on one page.
......@@ -154,12 +154,12 @@ class LinkPager extends Widget
$currentPage = $this->pagination->getPage();
// first page
if ($this->firstPageLabel !== null) {
if ($this->firstPageLabel !== false) {
$buttons[] = $this->renderPageButton($this->firstPageLabel, 0, $this->firstPageCssClass, $currentPage <= 0, false);
}
// prev page
if ($this->prevPageLabel !== null) {
if ($this->prevPageLabel !== false) {
if (($page = $currentPage - 1) < 0) {
$page = 0;
}
......@@ -173,7 +173,7 @@ class LinkPager extends Widget
}
// next page
if ($this->nextPageLabel !== null) {
if ($this->nextPageLabel !== false) {
if (($page = $currentPage + 1) >= $pageCount - 1) {
$page = $pageCount - 1;
}
......@@ -181,7 +181,7 @@ class LinkPager extends Widget
}
// last page
if ($this->lastPageLabel !== null) {
if ($this->lastPageLabel !== false) {
$buttons[] = $this->renderPageButton($this->lastPageLabel, $pageCount - 1, $this->lastPageCssClass, $currentPage >= $pageCount - 1, false);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment