Nice Menus module generate empty submenu, when submenu has invisible items (e.g. for "views" or "Image styles" items).

empty submenus
empty submenus

It is simple to fix this problem. Add to nicemenus.module, line 569, theme_nice_menus_build function:

     // ................
      if ($trail && in_array($mlid, $trail)) {
        $class .= ' active-trail';
      }
			
      // ------------ added
      if ($has_below = !empty($menu_item['below'])) {
            foreach ($menu_item['below'] as $below_item) {
                  $has_below = $below_item['link']['hidden'] == 0;
                  if ($has_below) {
                        break;
                  }
            }
      }
      // ------------ added
			
      // If it has children build a nice little tree under it.
      // Build a nice little tree under it if it has children, and has been set
      // to expand (when that option is being respected).
      if ((!empty($menu_item['link']['has_children'])) &&
          ($has_below) && $depth != 0 &&  // <-- changed from:  (!empty($menu_item['below'])) && $depth != 0 &&
          ($respect_expanded == 0 || $menu_item['link']['expanded'])) {
      // ......

Comments

formatix labs’s picture

Issue summary: View changes
formatix labs’s picture

Issue summary: View changes
StatusFileSize
new15.83 KB
new18.32 KB
avpaderno’s picture

Version: 7.x-2.5 » 7.x-2.x-dev
astonvictor’s picture

Status: Active » Closed (outdated)

D7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.