Commit 4207021e authored by Alexander Makarov's avatar Alexander Makarov

Fixes #6150: `yii\bootstrap\Tabs` dropdown IDs were generated incorrectly

parent 87b63743
...@@ -5,6 +5,7 @@ Yii Framework 2 bootstrap extension Change Log ...@@ -5,6 +5,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)
- Bug #6150: `yii\bootstrap\Tabs` dropdown IDs were generated incorrectly (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 #4450: Added `yii\bootstrap\Nav::renderDropdown()` (qiangxue) - 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)
......
...@@ -154,7 +154,7 @@ class Tabs extends Widget ...@@ -154,7 +154,7 @@ class Tabs extends Widget
$label .= ' <b class="caret"></b>'; $label .= ' <b class="caret"></b>';
Html::addCssClass($headerOptions, 'dropdown'); Html::addCssClass($headerOptions, 'dropdown');
if ($this->renderDropdown($item['items'], $panes)) { if ($this->renderDropdown($n, $item['items'], $panes)) {
Html::addCssClass($headerOptions, 'active'); Html::addCssClass($headerOptions, 'active');
} }
...@@ -202,12 +202,13 @@ class Tabs extends Widget ...@@ -202,12 +202,13 @@ class Tabs extends Widget
/** /**
* Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also * Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also
* configure `panes` accordingly. * configure `panes` accordingly.
* @param string $itemNumber number of the item
* @param array $items the dropdown items configuration. * @param array $items the dropdown items configuration.
* @param array $panes the panes reference array. * @param array $panes the panes reference array.
* @return boolean whether any of the dropdown items is `active` or not. * @return boolean whether any of the dropdown items is `active` or not.
* @throws InvalidConfigException * @throws InvalidConfigException
*/ */
protected function renderDropdown(&$items, &$panes) protected function renderDropdown($itemNumber, &$items, &$panes)
{ {
$itemActive = false; $itemActive = false;
...@@ -228,7 +229,7 @@ class Tabs extends Widget ...@@ -228,7 +229,7 @@ class Tabs extends Widget
$itemActive = true; $itemActive = true;
} }
$options['id'] = ArrayHelper::getValue($options, 'id', $this->options['id'] . '-dd-tab' . $n); $options['id'] = ArrayHelper::getValue($options, 'id', $this->options['id'] . '-dd' . $itemNumber . '-tab' . $n);
$item['url'] = '#' . $options['id']; $item['url'] = '#' . $options['id'];
$item['linkOptions']['data-toggle'] = 'tab'; $item['linkOptions']['data-toggle'] = 'tab';
......
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