diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-04-06 04:48:39 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-04-06 04:48:39 +0000 |
commit | 0f79c1e9462f16de3bd0bc3f199b48906cb092af (patch) | |
tree | a1cfdec162b10db2fbb279cbe9d58bce32bb5cc4 /modules | |
parent | 18e852e4e7839957639c8b3aa319d947f65f28ff (diff) | |
download | brdo-0f79c1e9462f16de3bd0bc3f199b48906cb092af.tar.gz brdo-0f79c1e9462f16de3bd0bc3f199b48906cb092af.tar.bz2 |
- Improve recursion in taxonomy_get_tree() (Morbus)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/taxonomy.module | 18 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module index 8fb5163d6..150796ff3 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -624,15 +624,15 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) { } $max_depth = (is_null($max_depth)) ? count($children[$vid]) : $max_depth; - if ($children[$vid][$parent]) { - foreach ($children[$vid][$parent] as $child) { - if ($max_depth > $depth) { - $terms[$vid][$child]->depth = $depth; - // The "parent" attribute is not useful, as it would show one parent only. - unset($terms[$vid][$child]->parent); - $terms[$vid][$child]->parents = $parents[$vid][$child]; - $tree[] = $terms[$vid][$child]; - + foreach ($children[$vid][$parent] as $child) { + if ($max_depth > $depth) { + $terms[$vid][$child]->depth = $depth; + // The "parent" attribute is not useful, as it would show one parent only. + unset($terms[$vid][$child]->parent); + $terms[$vid][$child]->parents = $parents[$vid][$child]; + $tree[] = $terms[$vid][$child]; + + if ($children[$vid][$child]) { $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth)); } } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 8fb5163d6..150796ff3 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -624,15 +624,15 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) { } $max_depth = (is_null($max_depth)) ? count($children[$vid]) : $max_depth; - if ($children[$vid][$parent]) { - foreach ($children[$vid][$parent] as $child) { - if ($max_depth > $depth) { - $terms[$vid][$child]->depth = $depth; - // The "parent" attribute is not useful, as it would show one parent only. - unset($terms[$vid][$child]->parent); - $terms[$vid][$child]->parents = $parents[$vid][$child]; - $tree[] = $terms[$vid][$child]; - + foreach ($children[$vid][$parent] as $child) { + if ($max_depth > $depth) { + $terms[$vid][$child]->depth = $depth; + // The "parent" attribute is not useful, as it would show one parent only. + unset($terms[$vid][$child]->parent); + $terms[$vid][$child]->parents = $parents[$vid][$child]; + $tree[] = $terms[$vid][$child]; + + if ($children[$vid][$child]) { $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth)); } } |