src/modules/Accordion.php
public function renderItem($item, $index)
    {
        if (array_key_exists('content', $item)) {
            $label = ArrayHelper::getValue($item, 'label');
            $options = ArrayHelper::getValue($item, 'options', []);
            $options['id'] = $this->options['id'] . '-accordion' . $index;
            $contentOptions = ArrayHelper::getValue($item, 'contentOptions', []);

            if (ArrayHelper::getValue($item, 'active')) {
                Html::addCssClass($options, 'active');
                Html::addCssClass($contentOptions, 'active');
            }

            Html::addCssClass($options, 'title');
            Html::addCssClass($contentOptions, 'content');

            $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
            if ($encodeLabel) {
                $label = Html::encode($label);
            }
            $title = Html::tag('i', '', ['class' => 'dropdown icon']) . $label;
        } else {
            throw new InvalidConfigException('The "content" option is required.');
        }
        $group = [];
        $group[] = Html::tag('div', $title, $options) . "\n";
        $group[] = Html::tag('div', $item['content'], $contentOptions) . "\n";
        return implode("\n", $group);
    }
public function renderItem($item, $index)
    {
        if (array_key_exists('content', $item)) {
            $label = ArrayHelper::getValue($item, 'label');
            $options = ArrayHelper::getValue($item, 'options', []);
            $options['id'] = $this->options['id'] . '-accordion' . $index;
            $contentOptions = ArrayHelper::getValue($item, 'contentOptions', []);

            if (ArrayHelper::getValue($item, 'active')) {
                Html::addCssClass($options, 'active');
                Html::addCssClass($contentOptions, 'active');
            }

            Html::addCssClass($options, 'title');
            Html::addCssClass($contentOptions, 'content');

            $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
            if ($encodeLabel) {
                $label = Html::encode($label);
            }
            $title = Html::tag('i', '', ['class' => 'dropdown icon']) . $label;
        } else {
            throw new InvalidConfigException('The "content" option is required.');
        }
        $group = [];
        $group[] = Html::tag('div', $title, $options) . "\n";
        $group[] = Html::tag('div', $item['content'], $contentOptions) . "\n";
        return implode("\n", $group);
    }
Renders a single collapsible item group

@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