From 1629f04186cc74ba544c7f17e223020e1d2f944e Mon Sep 17 00:00:00 2001 From: Thiago Talma Date: Tue, 17 Jan 2017 19:50:17 -0200 Subject: [PATCH] Fixes #174: Added `yii\bootstrap\Tabs::renderPanes()` to allow extending the class to manipulate the content between the tabs and the content --- CHANGELOG.md | 1 + Tabs.php | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 570939d..21ad0da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Yii Framework 2 bootstrap extension Change Log - Enh #113: Allow URLs instead of content for Tab Widget Dropdown items (Okeanos) - Bug #143: Fixed `yii\bootstrap\Nav` to use tags according to bootstrap docs (PowerGamer1) - Bug #162: Fixed `yii\bootstrap\Nav` not taking explicit `active` into account when `activateItems` is off (samdark) +- Enh #174: Added `yii\bootstrap\Tabs::renderPanes()` to allow extending the class to manipulate the content between the tabs and the content (thiagotalma) 2.0.6 March 17, 2016 -------------------- diff --git a/Tabs.php b/Tabs.php index 3173040..d8f174f 100644 --- a/Tabs.php +++ b/Tabs.php @@ -213,8 +213,7 @@ class Tabs extends Widget $headers[] = Html::tag('li', $header, $headerOptions); } - return Html::tag('ul', implode("\n", $headers), $this->options) - . ($this->renderTabContent ? "\n" . Html::tag('div', implode("\n", $panes), ['class' => 'tab-content']) : ''); + return Html::tag('ul', implode("\n", $headers), $this->options) . $this->renderPanes($panes); } /** @@ -279,4 +278,16 @@ class Tabs extends Widget return $itemActive; } + + /** + * Renders tab panes. + * + * @param array $panes + * @return string the rendering result. + * @since 2.0.7 + */ + public function renderPanes($panes) + { + return $this->renderTabContent ? "\n" . Html::tag('div', implode("\n", $panes), ['class' => 'tab-content']) : ''; + } }