Commit 439c2e4d by Qiang Xue

Fixes #4450: Added `yii\bootstrap\Nav::renderDropdown()`

parent 2782adcc
...@@ -6,6 +6,7 @@ Yii Framework 2 bootstrap extension Change Log ...@@ -6,6 +6,7 @@ Yii Framework 2 bootstrap extension Change Log
- Bug #5570: `yii\bootstrap\Tabs` would throw an exception if `content` is not set for one of its `items` (RomeroMsk) - Bug #5570: `yii\bootstrap\Tabs` would throw an exception if `content` is not set for one of its `items` (RomeroMsk)
- Enh #4181: Added `yii\bootstrap\Modal::$headerOptions` and `yii\bootstrap\Modal::$footerOptions` (tuxoff, samdark) - Enh #4181: Added `yii\bootstrap\Modal::$headerOptions` and `yii\bootstrap\Modal::$footerOptions` (tuxoff, samdark)
- Enh #4450: Added `yii\bootstrap\Nav::renderDropdown()` (qiangxue)
- Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk) - Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk)
- Enh #5799: `yii\bootstrap\ButtonGroup::buttons` can take all options that are supported by `yii\bootstrap\Button` (aleksanderd) - Enh #5799: `yii\bootstrap\ButtonGroup::buttons` can take all options that are supported by `yii\bootstrap\Button` (aleksanderd)
- Chg #5874: Upgraded Twitter Bootstrap to 3.3.x (samdark) - Chg #5874: Upgraded Twitter Bootstrap to 3.3.x (samdark)
......
...@@ -171,12 +171,7 @@ class Nav extends Widget ...@@ -171,12 +171,7 @@ class Nav extends Widget
if ($this->activateItems) { if ($this->activateItems) {
$items = $this->isChildActive($items, $active); $items = $this->isChildActive($items, $active);
} }
$items = Dropdown::widget([ $items = $this->renderDropdown($items);
'items' => $items,
'encodeLabels' => $this->encodeLabels,
'clientOptions' => false,
'view' => $this->getView(),
]);
} }
} }
...@@ -188,6 +183,23 @@ class Nav extends Widget ...@@ -188,6 +183,23 @@ class Nav extends Widget
} }
/** /**
* Renders the given items as a dropdown.
* This method is called to create sub-menus.
* @param array $items the given items. Please refer to [[Dropdown::items]] for the array structure.
* @return string the rendering result.
* @since 2.0.1
*/
protected function renderDropdown($items)
{
return Dropdown::widget([
'items' => $items,
'encodeLabels' => $this->encodeLabels,
'clientOptions' => false,
'view' => $this->getView(),
]);
}
/**
* Check to see if a child item is active optionally activating the parent. * Check to see if a child item is active optionally activating the parent.
* @param array $items @see items * @param array $items @see items
* @param boolean $active should the parent be active too * @param boolean $active should the parent be active too
......
...@@ -31,6 +31,7 @@ Yii Framework 2 Change Log ...@@ -31,6 +31,7 @@ Yii Framework 2 Change Log
- Bug: `yii\web\UrlRule` was unable to create URLs for rules containing unicode characters (samdark) - Bug: `yii\web\UrlRule` was unable to create URLs for rules containing unicode characters (samdark)
- Enh #4181: Added `yii\bootstrap\Modal::$headerOptions` and `yii\bootstrap\Modal::$footerOptions` (tuxoff, samdark) - Enh #4181: Added `yii\bootstrap\Modal::$headerOptions` and `yii\bootstrap\Modal::$footerOptions` (tuxoff, samdark)
- Enh #4263: Added migration and SQL schema files for `yii\log\DbTarget` (samdark) - Enh #4263: Added migration and SQL schema files for `yii\log\DbTarget` (samdark)
- Enh #4450: Added `yii\bootstrap\Nav::renderDropdown()` (qiangxue)
- Enh #4457: Added support for using noscript for css files registered through asset bundles and Html helper (samdark) - Enh #4457: Added support for using noscript for css files registered through asset bundles and Html helper (samdark)
- Enh #4492: Support PostgreSQL-specific syntax for `QueryBuilder::alterColumn()` (qiangxue) - Enh #4492: Support PostgreSQL-specific syntax for `QueryBuilder::alterColumn()` (qiangxue)
- Enh #4643: Extra options specified in `yii\widgets\Breadcrumbs::links` will be treated as HTML attributes for the generated hyperlinks (qiangxue) - Enh #4643: Extra options specified in `yii\widgets\Breadcrumbs::links` will be treated as HTML attributes for the generated hyperlinks (qiangxue)
......
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