aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt2
-rw-r--r--finder_menu.info1
-rw-r--r--finder_menu.module22
3 files changed, 23 insertions, 2 deletions
diff --git a/README.txt b/README.txt
index 0f7d82d..2e84cd7 100644
--- a/README.txt
+++ b/README.txt
@@ -6,3 +6,5 @@ at http://www.alistapart.com/articles/complexdynamiclists.
The code is mostly an adaptation from Dynamic Persistent
Menu found at http://drupal.org/project/dynamic_persistent_menu
+
+Additional code by Silvio - s1lv10 at uol.com.br.
diff --git a/finder_menu.info b/finder_menu.info
index 2f11110..601e8bd 100644
--- a/finder_menu.info
+++ b/finder_menu.info
@@ -2,4 +2,5 @@
name = Finder Menu
description = Show menu with Finder style.
core = 6.x
+version = "6.x-0.1"
dependencies[] = menu
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;
+}