diff options
author | Silvio <s1lv10@uol.com.br> | 2009-09-29 17:33:28 -0300 |
---|---|---|
committer | Silvio <s1lv10@uol.com.br> | 2009-09-29 17:33:28 -0300 |
commit | 64931c9a756e3420f038820e584efb927bdc2f52 (patch) | |
tree | 1c3a253c7d233f13c9f47ae61ee029121c64dfdd | |
parent | 1ca668c4937be08c43bd0ab2d9270c5c4ac68130 (diff) | |
download | finder_menu-64931c9a756e3420f038820e584efb927bdc2f52.tar.gz finder_menu-64931c9a756e3420f038820e584efb927bdc2f52.tar.bz2 |
Minor changes and fixes
-rw-r--r-- | README.txt | 2 | ||||
-rw-r--r-- | finder_menu.info | 1 | ||||
-rw-r--r-- | finder_menu.module | 22 |
3 files changed, 23 insertions, 2 deletions
@@ -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; +} |