aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <s1lv10@uol.com.br>2009-10-19 11:42:18 -0200
committerSilvio <s1lv10@uol.com.br>2009-10-19 11:42:18 -0200
commit7a43637d4b4e759f73045423357796e851593f4e (patch)
tree09d66505ffabfec4b7a4b86870ae9f82b213b4b4
parentbcd8ba38ea4a4b64bfd09461cb5a4c1b5405fd84 (diff)
downloadfinder_menu-7a43637d4b4e759f73045423357796e851593f4e.tar.gz
finder_menu-7a43637d4b4e759f73045423357796e851593f4e.tar.bz2
Adding back functions
Adding back finder_menu_list() and finder_menu_has_unhidden_submenu()
-rw-r--r--finder_menu.module56
1 files changed, 55 insertions, 1 deletions
diff --git a/finder_menu.module b/finder_menu.module
index 1b65d7e..9341aad 100644
--- a/finder_menu.module
+++ b/finder_menu.module
@@ -129,7 +129,7 @@ function theme_finder_menu($menu_name, $mlid) {
// Build the menus
$output = '<div id="finderparent">';
- $output .= taxonomy_node_tree_list($menu, 'finder', 'hidden');
+ $output .= finder_menu_list($menu, 'finder', 'hidden');
$output .= '</div>';
return $output;
@@ -152,3 +152,57 @@ function theme_finder_menu_javascript() {
function theme_finder_menu_css() {
drupal_add_css(drupal_get_path('module', 'finder_menu') .'/finder_menu.css');
}
+
+/**
+ * Recursively build the menu.
+ *
+ * @ingroup themeable
+ */
+function finder_menu_list($menu, $id, $class, &$level = NULL) {
+
+ if ($level == NULL) {
+ $output = '<ul id="' . $id .'" class="'. $class .'">';
+ $output .= implode((array) module_invoke_all('finder_menu_list'));
+ $level = 0;
+ }
+ else {
+ $output = '<ul id="'. $id .'[ul]['. $level .']" class="'. $class .'">';
+ }
+
+ foreach ($menu as $menu_item) {
+ if ($menu_item['link']['hidden'] == 0) {
+ $output .= '<li>';
+ if ($menu_item['below'] !== FALSE && finder_menu_has_unhidden_submenu($menu_item['below'])) {
+ $level++;
+ $output .= $menu_item['link']['title'];
+ $output .= finder_menu_list($menu_item['below'], $id, $class, $level);
+ }
+ else {
+ $output .= theme('menu_item_link', $menu_item['link']);
+ }
+ $output .= '</li>';
+ }
+ }
+
+ $output .= '</ul>';
+ 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;
+}