-
-
Notifications
You must be signed in to change notification settings - Fork 190
Closed
Description
For example:
echo Collapse::widget([
'items' => [
'Introduction' => 'This is the first collapsable menu',
'Second panel' => [
'content' => 'This is the second collapsable menu',
],
]
])would be the equivalent of
echo Collapse::widget([
'items' => [
[
'label' => 'Introduction',
'content' => 'This is the first collapsable menu',
],
[
'lable' => 'Second panel',
'content' => 'This is the second collapsable menu',
],
]
])The patch is actually very simple, for example for the Tabs widget you only need to change the lines https://github.com/yiisoft/yii2-bootstrap/blob/master/Tabs.php#L155-159 to
if (!is_string($key) && !array_key_exists('label', $item)) {
throw new InvalidConfigException(
"The 'label' option is required."
);
}
if (is_string($item)) {
$item = ['content' => $item];
}
$label = is_string($key) ? $key : $item['label'];
$encodeLabel = isset($item['encode'])
? $item['encode']
: $this->encodeLabels;
$label = $encodeLabel
? Html::encode($label)
: $label;Metadata
Metadata
Assignees
Labels
type:enhancementEnhancementEnhancement