mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Hide menu container tag when items is empty
This commit is contained in:
@ -166,9 +166,11 @@ class Menu extends Widget
|
||||
$this->params = Yii::$app->request->getQueryParams();
|
||||
}
|
||||
$items = $this->normalizeItems($this->items, $hasActiveChild);
|
||||
$options = $this->options;
|
||||
$tag = ArrayHelper::remove($options, 'tag', 'ul');
|
||||
echo Html::tag($tag, $this->renderItems($items), $options);
|
||||
if (!empty($items)) {
|
||||
$options = $this->options;
|
||||
$tag = ArrayHelper::remove($options, 'tag', 'ul');
|
||||
echo Html::tag($tag, $this->renderItems($items), $options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user