src/widget/Collapse.php
public function renderItem($header, $item, $index)
    {
        if (isset($item['content'])) {            
            $options = ArrayHelper::getValue($item, 'contentOptions', []);
            
            if($this->header){
                $id = $this->options['id'] . '-collapse' . $index;
                $options['id'] = $id;
            }else if(!isset($options['id'])){
                throw new InvalidConfigException('ContentOptions "id" need to be specify.');
            }
            
            Html::addCssClass($options, 'panel-collapse collapse');

            if($this->header){
				$headerToggle = Html::a($header, '#' . $id, [
                    'class' => 'collapse-toggle',
                    'data-toggle' => 'collapse',
                    'data-parent' => '#' . $this->options['id']
                ]) . "\n";
                $header = Html::tag('h4', $headerToggle, ['class' => ($this->box) ? 'box-title' : 'panel-title']);
            }
            $content = Html::tag('div', $item['content'], ['class' => ($this->box) ? 'box-body' : 'panel-body']) . "\n";
        } else {
            throw new InvalidConfigException('The "content" option is required.');
        }
        $group = [];
        if($this->header){
            $group[] = Html::tag('div', $header, ['class' => ($this->box) ? 'box-header' : 'panel-heading']);
        }
        $group[] = Html::tag('div', $content, $options);

        return implode("\n", $group);
    }
public function renderItem($header, $item, $index)
    {
        if (isset($item['content'])) {            
            $options = ArrayHelper::getValue($item, 'contentOptions', []);
            
            if($this->header){
                $id = $this->options['id'] . '-collapse' . $index;
                $options['id'] = $id;
            }else if(!isset($options['id'])){
                throw new InvalidConfigException('ContentOptions "id" need to be specify.');
            }
            
            Html::addCssClass($options, 'panel-collapse collapse');

            if($this->header){
				$headerToggle = Html::a($header, '#' . $id, [
                    'class' => 'collapse-toggle',
                    'data-toggle' => 'collapse',
                    'data-parent' => '#' . $this->options['id']
                ]) . "\n";
                $header = Html::tag('h4', $headerToggle, ['class' => ($this->box) ? 'box-title' : 'panel-title']);
            }
            $content = Html::tag('div', $item['content'], ['class' => ($this->box) ? 'box-body' : 'panel-body']) . "\n";
        } else {
            throw new InvalidConfigException('The "content" option is required.');
        }
        $group = [];
        if($this->header){
            $group[] = Html::tag('div', $header, ['class' => ($this->box) ? 'box-header' : 'panel-heading']);
        }
        $group[] = Html::tag('div', $content, $options);

        return implode("\n", $group);
    }
Renders a single collapsible item group
@param string $header a label of the item group [[items]]
@param array $item a single item from [[items]]
@param integer $index the item index as each item group content must have an id
@return string the rendering result
@throws InvalidConfigException