Browse Source

Added ability to `yii\bootstrap\Tabs` to encode each `Tabs::items['label']` separately

tags/2.0.0-rc
Dmitry Chernikov 11 years ago
parent
commit
16d33b5586
  1. 4
      Tabs.php

4
Tabs.php

@ -58,6 +58,7 @@ class Tabs extends Widget
* tab with the following structure: * tab with the following structure:
* *
* - label: string, required, the tab header label. * - label: string, required, the tab header label.
* - encode: boolean, optional, whether this label should be HTML-encoded.
* - headerOptions: array, optional, the HTML attributes of the tab header. * - headerOptions: array, optional, the HTML attributes of the tab header.
* - linkOptions: array, optional, the HTML attributes of the tab header link tags. * - linkOptions: array, optional, the HTML attributes of the tab header link tags.
* - content: string, 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.
@ -136,7 +137,8 @@ class Tabs extends Widget
if (!isset($item['label'])) { if (!isset($item['label'])) {
throw new InvalidConfigException("The 'label' option is required."); 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', [])); $headerOptions = array_merge($this->headerOptions, ArrayHelper::getValue($item, 'headerOptions', []));
$linkOptions = array_merge($this->linkOptions, ArrayHelper::getValue($item, 'linkOptions', [])); $linkOptions = array_merge($this->linkOptions, ArrayHelper::getValue($item, 'linkOptions', []));

Loading…
Cancel
Save