Skip to content

Commit de82953

Browse files
author
Mikaël Capelle
committed
Add possibility to specify panel count manually.
1 parent 07e0029 commit de82953

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/View/Helper/BootstrapPanelHelper.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,24 @@ public function create($title = null, $options = []) {
109109
'no-body' => false,
110110
'type' => 'default',
111111
'collapsible' => $this->config('collapsible'),
112-
'open' => !$this->_groupInGroup
112+
'open' => !$this->_groupInGroup,
113+
'panel-count' => $this->_panelCount
113114
];
114115

115116
$nobody = $options['no-body'];
116117
$type = $options['type'];
117118
$open = $options['open'];
118119
$this->_collapsible = $options['collapsible'];
120+
$panelCount = $options['panel-count'];
119121
unset ($options['no-body'], $options['collapsible'],
120-
$options['type'], $options['open']);
122+
$options['type'], $options['open'], $options['panel-count']);
121123

122124
$options = $this->addClass($options, ['panel', 'panel-'.$type]);
123125

124126
if ($this->_collapsible) {
125-
$this->_headId = 'heading-'.($this->_panelCount);
126-
$this->_bodyId = 'collapse-'.($this->_panelCount);
127-
$this->_panelCount++;
127+
$this->_headId = 'heading-'.$panelCount;
128+
$this->_bodyId = 'collapse-'.$panelCount;
129+
$this->_panelCount = intval($panelCount) + 1;
128130
if ($open) {
129131
$this->_groupPanelOpen = $this->_bodyId;
130132
}

0 commit comments

Comments
 (0)