aboutsummaryrefslogtreecommitdiff
path: root/finder_menu.module
diff options
context:
space:
mode:
Diffstat (limited to 'finder_menu.module')
-rw-r--r--finder_menu.module22
1 files changed, 20 insertions, 2 deletions
diff --git a/finder_menu.module b/finder_menu.module
index 91a749d..e8d4a3e 100644
--- a/finder_menu.module
+++ b/finder_menu.module
@@ -131,10 +131,10 @@ function finder_menu_build($menu, $first = FALSE) {
$output = '<ul>';
}
- foreach($menu as $menu_item) {
+ foreach ($menu as $menu_item) {
if ($menu_item['link']['hidden'] == 0) {
$output .= '<li>';
- if ($menu_item['below'] !== FALSE) {
+ if ($menu_item['below'] !== FALSE && finder_menu_has_unhidden_submenu($menu_item['below'])) {
$output .= $menu_item['link']['title'];
$output .= finder_menu_build($menu_item['below']);
} else {
@@ -148,3 +148,21 @@ function finder_menu_build($menu, $first = FALSE) {
return $output;
}
+
+/**
+ * Check whether a menu has at least one unhidden submenu.
+ */
+function finder_menu_has_unhidden_submenu($menu = FALSE) {
+
+ if ($menu == FALSE) {
+ return FALSE;
+ }
+
+ foreach ($menu as $menu_item) {
+ if ($menu_item['link']['hidden'] == 0) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}