aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <s1lv10@uol.com.br>2009-10-19 11:41:33 -0200
committerSilvio <s1lv10@uol.com.br>2009-10-19 11:41:33 -0200
commitd823706a4c0b817e1984503d062afc96d8d992dd (patch)
tree7f38dbf4946949bd74f3af04a21b9aa7c8bad175
parent3c86ad79c908e0cac0281f4a431eb7ba3a13ea81 (diff)
downloadtaxonomy_node_tree-d823706a4c0b817e1984503d062afc96d8d992dd.tar.gz
taxonomy_node_tree-d823706a4c0b817e1984503d062afc96d8d992dd.tar.bz2
Changing taxonomy_node_tree_list()
-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;
-}