diff options
author | Silvio <silvio@socioambiental.org> | 2014-03-26 16:55:50 -0300 |
---|---|---|
committer | Silvio <silvio@socioambiental.org> | 2014-03-26 16:55:50 -0300 |
commit | 293a297fe62c89563a40f09a124403c18d42ad07 (patch) | |
tree | 5522da368528e1f1aaefbb087a47f2edb309b3e8 | |
parent | abb091f8906bf6f98d95e54fbe302c41b7722e27 (diff) | |
download | taxonomy_node_tree-develop.tar.gz taxonomy_node_tree-develop.tar.bz2 |
-rw-r--r-- | taxonomy_node_tree.module | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/taxonomy_node_tree.module b/taxonomy_node_tree.module index 184ec0f..85a60e9 100644 --- a/taxonomy_node_tree.module +++ b/taxonomy_node_tree.module @@ -59,11 +59,11 @@ function taxonomy_node_tree_parents($vid) { function taxonomy_node_tree_index($nodes, $terms) { while ($node = db_fetch_object($nodes)) { foreach ($terms as $term) { - // add nodes into the term + // Add nodes into the term if ($node->tid == $term->tid) { $term->nodes[] = $node; } - // update an index of terms + // Update an index of terms $tree[$term->tid] = $term; } } @@ -96,6 +96,7 @@ function taxonomy_node_tree_relation($tree) { } } } + return $tree; } @@ -112,13 +113,14 @@ function taxonomy_node_tree_relation($tree) { */ function taxonomy_node_tree_sort(&$tree, $term) { if ($term->parents[0] != 0 && isset($tree[$term->parents[0]])) { - // is child + // Is child if (isset($term->children)) { // is also parent, so go down one level foreach ($term->children as $child) { taxonomy_node_tree_sort($tree, $tree[$child]); } } + $tree[$term->parents[0]]->below[] = drupal_clone($term); unset($tree[$term->tid]); } @@ -139,6 +141,7 @@ function taxonomy_node_tree_hierarchy($tree) { taxonomy_node_tree_sort($tree, $term); } } + return $tree; } @@ -398,7 +401,6 @@ function taxonomy_node_tree_theme() { * Rendered HTML tree. */ function theme_taxonomy_node_tree_list($term, $id, $class, $baselink = NULL, $level = NULL, $active_link = NULL) { - if ($level == NULL) { $level = 0; } |