mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 06:11:35 +08:00
Fixes #8064: Added ability to remove containing menu tag by setting yii\widgets\Menu::$options['tag']
to false
This commit is contained in:

committed by
Alexander Makarov

parent
ea55a71a2c
commit
cafd135022
@ -79,7 +79,7 @@ class Menu extends Widget
|
||||
* specifies its `options`, it will be merged with this property before being used to generate the HTML
|
||||
* attributes for the menu item tag. The following special options are recognized:
|
||||
*
|
||||
* - tag: string, defaults to "li", the tag name of the item container tags.
|
||||
* - tag: string, defaults to "li", the tag name of the item container tags. Set to false to disable container tag.
|
||||
*
|
||||
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
|
||||
*/
|
||||
@ -175,7 +175,12 @@ class Menu extends Widget
|
||||
if (!empty($items)) {
|
||||
$options = $this->options;
|
||||
$tag = ArrayHelper::remove($options, 'tag', 'ul');
|
||||
echo Html::tag($tag, $this->renderItems($items), $options);
|
||||
|
||||
if ($tag !== false) {
|
||||
echo Html::tag($tag, $this->renderItems($items), $options);
|
||||
} else {
|
||||
echo $this->renderItems($items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user