From 16d33b55869dee4e2ef9595e3796a250e3c19854 Mon Sep 17 00:00:00 2001 From: Dmitry Chernikov <4ernikoff@gmail.com> Date: Mon, 23 Jun 2014 18:57:28 +0300 Subject: [PATCH] Added ability to `yii\bootstrap\Tabs` to encode each `Tabs::items['label']` separately --- Tabs.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tabs.php b/Tabs.php index b968d23..dac17d7 100644 --- a/Tabs.php +++ b/Tabs.php @@ -58,6 +58,7 @@ 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. * - headerOptions: array, optional, the HTML attributes of the tab header. * - 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. @@ -136,7 +137,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', []));