Commit afda91e0 by Qiang Xue

Fixes #2361: `yii\bootstrap\NavBar::brandUrl` should default to the home URL of application

parent 89f9f0e9
......@@ -4,6 +4,7 @@ Yii Framework 2 bootstrap extension Change Log
2.0.0 beta under development
----------------------------
- Bug #2361: `yii\bootstrap\NavBar::brandUrl` should default to the home URL of application (qiangxue)
- Enh #1474: Added option to make NavBar 100% width (cebe)
- Enh #1553: Only add navbar-default class to NavBar when no other class is specified (cebe)
- Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight)
......
......@@ -7,6 +7,7 @@
namespace yii\bootstrap;
use Yii;
use yii\helpers\Html;
/**
......@@ -43,9 +44,9 @@ class NavBar extends Widget
public $brandLabel;
/**
* @param array|string $url the URL for the brand's hyperlink tag. This parameter will be processed by [[Html::url()]]
* and will be used for the "href" attribute of the brand link. Defaults to site root.
* and will be used for the "href" attribute of the brand link. If not set, [[\yii\web\Application::homeUrl]] will be used.
*/
public $brandUrl = '/';
public $brandUrl;
/**
* @var array the HTML attributes of the brand link.
*/
......@@ -84,7 +85,7 @@ class NavBar extends Widget
echo Html::beginTag('div', ['class' => 'navbar-header']);
echo $this->renderToggleButton();
if ($this->brandLabel !== null) {
echo Html::a($this->brandLabel, $this->brandUrl, $this->brandOptions);
echo Html::a($this->brandLabel, $this->brandUrl === null ? Yii::$app->homeUrl : $this->brandUrl, $this->brandOptions);
}
echo Html::endTag('div');
......
......@@ -45,6 +45,7 @@ Yii Framework 2 Change Log
- Bug #2298: Fixed the bug that Gii controller generator did not allow digit in the controller ID (qiangxue)
- Bug #2303: Fixed the bug that `yii\base\Theme::pathMap` did not support dynamic update with path aliases (qiangxue)
- Bug #2324: Fixed QueryBuilder bug when building a query with "query" option (mintao)
- Bug #2361: `yii\bootstrap\NavBar::brandUrl` should default to the home URL of application (qiangxue)
- Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark)
- Bug: Fixed incorrect event name for `yii\jui\Spinner` (samdark)
- Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe)
......
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