aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--taxonomy_node_tree.module57
1 files changed, 21 insertions, 36 deletions
diff --git a/taxonomy_node_tree.module b/taxonomy_node_tree.module
index acbc1d0..31e0f44 100644
--- a/taxonomy_node_tree.module
+++ b/taxonomy_node_tree.module
@@ -214,57 +214,42 @@ function taxonomy_node_tree_taxonomy_get_tree($vid, $parent = 0, $depth = -1, $m
}
-
/**
- * Recursively build the menu.
+ * Recursively build an HTML taxonomy node tree.
*
* @ingroup themeable
+ * @TODO: usage with hook_theme();
*/
-function taxonomy_node_tree_list($menu, $id, $class, &$level = NULL) {
+function taxonomy_node_tree_list($term, $id, $class, $baselink = NULL, &$level = NULL) {
if ($level == NULL) {
- $output = '<ul id="' . $id .'" class="'. $class .'">';
- $output .= implode((array) module_invoke_all('taxonomy_node_tree_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 && taxonomy_node_tree_has_unhidden_submenu($menu_item['below'])) {
- $level++;
- $output .= $menu_item['link']['title'];
- $output .= taxonomy_node_tree_list($menu_item['below'], $id, $class, $level);
+ $level++;
+
+ if (isset($term->tid)) {
+ $output .= '<li>';
+ $output .= $term->name;
+ if (isset($term->below)) {
+ $output .= '<ul id="' . $id .'[ul]["'. $level .']" class="'. $class .'">';
+ foreach ($term->below as $child) {
+ $output .= taxonomy_node_tree_list($child, $id, $class, $baselink, $level);
}
- else {
- $output .= theme('menu_item_link', $menu_item['link']);
+ $output .= '</ul>';
+ }
+ else if (isset($term->nodes)) {
+ $output .= '<ul id="' . $id .'[ul]["'. $level .']" class="'. $class .'">';
+ foreach ($term->nodes as $node) {
+ $output .= '<li>';
+ $output .= '<a href="'. $GLOBALS['base_url'] .'/'. $baselink .'/'. $node->nid .'">'. $node->title .'</a>';
}
+ $output .= '</ul>';
$output .= '</li>';
}
+ $output .= '</li>';
}
- $output .= '</ul>';
return $output;
}
-
-/**
- * Check whether a menu has at least one unhidden submenu.
- */
-function taxonomy_node_tree_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;
-}