Skip to content

Commit

Permalink
Merge pull request Elgg#14673 from jeabakker/51_fixes
Browse files Browse the repository at this point in the history
fix(menus): no longer render empty menu sections
  • Loading branch information
jeabakker authored Aug 1, 2024
2 parents 171f289 + 72882fc commit 37d0be9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion views/default/navigation/menu/elements/section.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,20 @@

$lis = [];
foreach ($items as $menu_item) {
$lis[] = elgg_view('navigation/menu/elements/item', [
$item = elgg_view('navigation/menu/elements/item', [
'item' => $menu_item,
'item_class' => $item_class,
]);

if (empty($item)) {
continue;
}

$lis[] = $item;
}

if (empty($lis)) {
return;
}

echo elgg_format_element('ul', $vars, implode(PHP_EOL, $lis));

0 comments on commit 37d0be9

Please sign in to comment.