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