Skip to content

Commit

Permalink
Merge pull request #7733 from sbulen/submenu_check
Browse files Browse the repository at this point in the history
Remove menu item if all submenu items are disabled
  • Loading branch information
live627 authored Jul 12, 2023
2 parents a3f3beb + 6cbf26c commit d0850e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/Subs-Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ function createMenu($menuData, $menuOptions = array())
$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['disabled'] = true;
}

// If permissions removed/disabled for all submenu items, remove the menu item
if (empty($first_sa) && empty($last_sa))
{
unset($menu_context['sections'][$section_id]['areas'][$area_id]);
continue;
}

// Set which one is first, last and selected in the group.
if (!empty($menu_context['sections'][$section_id]['areas'][$area_id]['subsections']))
{
Expand Down

0 comments on commit d0850e9

Please sign in to comment.