summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-08 21:54:33 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-08 21:54:33 +0000
commit09b49acb67718b4c662a178d8d3147ff5a2fec6e (patch)
treed4c7f540a1636727c0efee477dacbad13b24d6dc /modules
parent55382d04a7438210bef7252dec960b3e8a00c263 (diff)
downloadbrdo-09b49acb67718b4c662a178d8d3147ff5a2fec6e.tar.gz
brdo-09b49acb67718b4c662a178d8d3147ff5a2fec6e.tar.bz2
- Patch #343259 by John Morahan: improved taxonomy_get_tree API.
Diffstat (limited to 'modules')
-rw-r--r--modules/blogapi/blogapi.module2
-rw-r--r--modules/taxonomy/taxonomy.module12
2 files changed, 7 insertions, 7 deletions
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index a947dbfec..1ad44a19d 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -499,7 +499,7 @@ function blogapi_metaweblog_get_category_list($blogid, $username, $password) {
$categories = array();
if ($vocabularies) {
foreach ($vocabularies as $vocabulary) {
- $terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0, -1);
+ $terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid);
foreach ($terms as $term) {
$term_name = $term->name;
foreach (module_invoke('taxonomy', 'get_parents', $term->tid, 'tid') as $parent) {
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index eaddef26d..575e4dc17 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -850,18 +850,18 @@ function taxonomy_get_children($tid, $vid = 0, $key = 'tid') {
* The term ID under which to generate the tree. If 0, generate the tree
* for the entire vocabulary.
*
- * @param $depth
- * Internal use only.
- *
* @param $max_depth
* The number of levels of the tree to return. Leave NULL to return all levels.
*
+ * @param $depth
+ * Internal use only.
+ *
* @return
* An array of all term objects in the tree. Each term object is extended
* to have "depth" and "parents" attributes in addition to its normal ones.
* Results are statically cached.
*/
-function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) {
+function taxonomy_get_tree($vid, $parent = 0, $max_depth = NULL, $depth = -1) {
static $children, $parents, $terms;
$depth++;
@@ -892,7 +892,7 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) {
$tree[] = $term;
if (!empty($children[$vid][$child])) {
- $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth));
+ $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $max_depth, $depth));
}
}
}
@@ -1279,7 +1279,7 @@ function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $p
}
foreach ($tids as $index => $tid) {
$term = taxonomy_get_term_data($tid);
- $tree = taxonomy_get_tree($term->vid, $tid, -1, $depth);
+ $tree = taxonomy_get_tree($term->vid, $tid, $depth);
$descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
}