Browse Source

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

tags/2.0.1
Alexander Makarov 10 years ago
parent
commit
4207021e7a
  1. 1
      CHANGELOG.md
  2. 7
      Tabs.php

1
CHANGELOG.md

@ -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 #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 #4450: Added `yii\bootstrap\Nav::renderDropdown()` (qiangxue)
- Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk)

7
Tabs.php

@ -154,7 +154,7 @@ class Tabs extends Widget
$label .= ' <b class="caret"></b>';
Html::addCssClass($headerOptions, 'dropdown');
if ($this->renderDropdown($item['items'], $panes)) {
if ($this->renderDropdown($n, $item['items'], $panes)) {
Html::addCssClass($headerOptions, 'active');
}
@ -202,12 +202,13 @@ class Tabs extends Widget
/**
* Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also
* configure `panes` accordingly.
* @param string $itemNumber number of the item
* @param array $items the dropdown items configuration.
* @param array $panes the panes reference array.
* @return boolean whether any of the dropdown items is `active` or not.
* @throws InvalidConfigException
*/
protected function renderDropdown(&$items, &$panes)
protected function renderDropdown($itemNumber, &$items, &$panes)
{
$itemActive = false;
@ -228,7 +229,7 @@ class Tabs extends Widget
$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['linkOptions']['data-toggle'] = 'tab';

Loading…
Cancel
Save