Commit 12ded633 authored by Peter Dias's avatar Peter Dias
Browse files

MDL-72934 core_navigation: Early return if no nodes to be rendered.

Do not export any items for templates if the nodecollection does not
have any children.
parent eab63d2c
......@@ -57,8 +57,9 @@ class more_menu implements renderable, templatable {
public function export_for_template(renderer_base $output): array {
$data = ['navbarstyle' => $this->navbarstyle];
if ($this->haschildren) {
// The node collection doesn't have anything to render so exit now.
if (!isset($this->content->children) || count($this->content->children) == 0) {
$data = [];
return [];
}
$data['nodecollection'] = $this->content;
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment