From a53b3e577e9549d6f4a723852df3d1fd3d283433 Mon Sep 17 00:00:00 2001 From: tonydspaniard Date: Fri, 20 Dec 2013 12:48:38 +0100 Subject: [PATCH] Update collapse to use bootstrap 3 classes fixes #1459 --- extensions/yii/bootstrap/Collapse.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/extensions/yii/bootstrap/Collapse.php b/extensions/yii/bootstrap/Collapse.php index 08bde22..d77d15e 100644 --- a/extensions/yii/bootstrap/Collapse.php +++ b/extensions/yii/bootstrap/Collapse.php @@ -66,7 +66,7 @@ class Collapse extends Widget public function init() { parent::init(); - Html::addCssClass($this->options, 'accordion'); + Html::addCssClass($this->options, 'panel-group'); } /** @@ -90,7 +90,7 @@ class Collapse extends Widget $index = 0; foreach ($this->items as $header => $item) { $options = ArrayHelper::getValue($item, 'options', []); - Html::addCssClass($options, 'accordion-group'); + Html::addCssClass($options, 'panel panel-default'); $items[] = Html::tag('div', $this->renderItem($header, $item, ++$index), $options); } @@ -111,21 +111,23 @@ class Collapse extends Widget $id = $this->options['id'] . '-collapse' . $index; $options = ArrayHelper::getValue($item, 'contentOptions', []); $options['id'] = $id; - Html::addCssClass($options, 'accordion-body collapse'); + Html::addCssClass($options, 'panel-collapse collapse'); - $header = Html::a($header, '#' . $id, [ + $headerToggle = Html::a($header, '#' . $id, [ 'class' => 'accordion-toggle', 'data-toggle' => 'collapse', 'data-parent' => '#' . $this->options['id'] ]) . "\n"; - $content = Html::tag('div', $item['content'], ['class' => 'accordion-inner']) . "\n"; + $header = Html::tag('h4', $headerToggle, ['class' => 'panel-title']); + + $content = Html::tag('div', $item['content'], ['class' => 'panel-body']) . "\n"; } else { throw new InvalidConfigException('The "content" option is required.'); } $group = []; - $group[] = Html::tag('div', $header, ['class' => 'accordion-heading']); + $group[] = Html::tag('div', $header, ['class' => 'panel-heading']); $group[] = Html::tag('div', $content, $options); return implode("\n", $group);