Commit f70e7bdf by Alexander Makarov

Merge pull request #4024 from umneeq/yii-bootstrap-tabs-enh

Added ability to `yii\bootstrap\Tabs` to encode each `Tabs::items['label']` separately
parents 9637fa1d 8f914bec
......@@ -7,9 +7,9 @@ Yii Framework 2 bootstrap extension Change Log
- Bug #3292: Fixed dropdown widgets rendering incorrect HTML (it3rmit)
- Bug #3740: Fixed duplicate error message when client validation is enabled (tadaszelvys)
- Bug #3749: Fixed invalid plugin registration and ensure clickable links in dropdown (kartik-v)
- Enh #4024: Added ability to `yii\bootstrap\Tabs` to encode each `Tabs::items['label']` separately (creocoder, umneeq)
- Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue)
2.0.0-beta April 13, 2014
-------------------------
......
......@@ -58,13 +58,15 @@ class Tabs extends Widget
* tab with the following structure:
*
* - label: string, required, the tab header label.
* - encode: boolean, optional, whether this label should be HTML-encoded. This param will override
* global `$this->encodeLabels` param.
* - headerOptions: array, optional, the HTML attributes of the tab header.
* - linkOptions: array, optional, the HTML attributes of the tab header link tags.
* - content: array, required if `items` is not set. The content (HTML) of the tab pane.
* - content: string, required if `items` is not set. The content (HTML) of the tab pane.
* - options: array, optional, the HTML attributes of the tab pane container.
* - active: boolean, optional, whether the item tab header and pane should be visible or not.
* - items: array, optional, if not set then `content` will be required. The `items` specify a dropdown items
* configuration array. Each item can hold two extra keys, besides the above ones:
* configuration array. Each item can hold three extra keys, besides the above ones:
* * active: boolean, optional, whether the item tab header and pane should be visible or not.
* * content: string, required if `items` is not set. The content (HTML) of the tab pane.
* * contentOptions: optional, array, the HTML attributes of the tab content container.
......@@ -136,7 +138,8 @@ class Tabs extends Widget
if (!isset($item['label'])) {
throw new InvalidConfigException("The 'label' option is required.");
}
$label = $this->encodeLabels ? Html::encode($item['label']) : $item['label'];
$encodeLabel = $this->encodeLabels || isset($item['encode']) && $item['encode'] === true;
$label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
$headerOptions = array_merge($this->headerOptions, ArrayHelper::getValue($item, 'headerOptions', []));
$linkOptions = array_merge($this->linkOptions, ArrayHelper::getValue($item, 'linkOptions', []));
......
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