Browse Source

Fixes #92: Allow overriding `data-toggle` in `yii\bootstrap\Tabs`

tags/2.0.6
Mehdi Achour 9 years ago committed by Alexander Makarov
parent
commit
7644ecbc44
  1. 1
      CHANGELOG.md
  2. 7
      Tabs.php

1
CHANGELOG.md

@ -17,6 +17,7 @@ Yii Framework 2 bootstrap extension Change Log
- Enh #43: Added support for the static form controls via `yii\bootstrap\Html` (klimov-paul) - Enh #43: Added support for the static form controls via `yii\bootstrap\Html` (klimov-paul)
- Enh #44: Fixed `yii\bootstrap\ButtonDropdown` renders two buttons with the same id, if 'split' is enabled (klimov-paul) - Enh #44: Fixed `yii\bootstrap\ButtonDropdown` renders two buttons with the same id, if 'split' is enabled (klimov-paul)
- Enh #50: Added `dropDownOptions` that is passed to `yii\bootstrap\Nav` dropdown items (fbau123) - Enh #50: Added `dropDownOptions` that is passed to `yii\bootstrap\Nav` dropdown items (fbau123)
- Enh #92: Allow overriding `data-toggle` in `yii\bootstrap\Tabs` (machour)
2.0.4 May 10, 2015 2.0.4 May 10, 2015

7
Tabs.php

@ -169,7 +169,9 @@ class Tabs extends Widget
} }
Html::addCssClass($linkOptions, ['widget' => 'dropdown-toggle']); Html::addCssClass($linkOptions, ['widget' => 'dropdown-toggle']);
if (!isset($linkOptions['data-toggle'])) {
$linkOptions['data-toggle'] = 'dropdown'; $linkOptions['data-toggle'] = 'dropdown';
}
$header = Html::a($label, "#", $linkOptions) . "\n" $header = Html::a($label, "#", $linkOptions) . "\n"
. Dropdown::widget(['items' => $item['items'], 'clientOptions' => false, 'view' => $this->getView()]); . Dropdown::widget(['items' => $item['items'], 'clientOptions' => false, 'view' => $this->getView()]);
} else { } else {
@ -185,7 +187,9 @@ class Tabs extends Widget
if (isset($item['url'])) { if (isset($item['url'])) {
$header = Html::a($label, $item['url'], $linkOptions); $header = Html::a($label, $item['url'], $linkOptions);
} else { } else {
if (!isset($linkOptions['data-toggle'])) {
$linkOptions['data-toggle'] = 'tab'; $linkOptions['data-toggle'] = 'tab';
}
$header = Html::a($label, '#' . $options['id'], $linkOptions); $header = Html::a($label, '#' . $options['id'], $linkOptions);
} }
@ -250,8 +254,9 @@ class Tabs extends Widget
$options['id'] = ArrayHelper::getValue($options, 'id', $this->options['id'] . '-dd' . $itemNumber . '-tab' . $n); $options['id'] = ArrayHelper::getValue($options, 'id', $this->options['id'] . '-dd' . $itemNumber . '-tab' . $n);
$item['url'] = '#' . $options['id']; $item['url'] = '#' . $options['id'];
if (!isset($item['linkOptions']['data-toggle'])) {
$item['linkOptions']['data-toggle'] = 'tab'; $item['linkOptions']['data-toggle'] = 'tab';
}
$panes[] = Html::tag('div', $content, $options); $panes[] = Html::tag('div', $content, $options);
unset($item); unset($item);

Loading…
Cancel
Save