Commit 7d3d5532 authored by Dries's avatar Dries
Browse files

- Fixed warning.

parent 6ba8f32c
...@@ -624,16 +624,18 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) { ...@@ -624,16 +624,18 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) {
} }
$max_depth = (is_null($max_depth)) ? count($children[$vid]) : $max_depth; $max_depth = (is_null($max_depth)) ? count($children[$vid]) : $max_depth;
foreach ($children[$vid][$parent] as $child) { if ($children[$vid][$parent]) {
if ($max_depth > $depth) { foreach ($children[$vid][$parent] as $child) {
$terms[$vid][$child]->depth = $depth; if ($max_depth > $depth) {
// The "parent" attribute is not useful, as it would show one parent only. $terms[$vid][$child]->depth = $depth;
unset($terms[$vid][$child]->parent); // The "parent" attribute is not useful, as it would show one parent only.
$terms[$vid][$child]->parents = $parents[$vid][$child]; unset($terms[$vid][$child]->parent);
$tree[] = $terms[$vid][$child]; $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)); if ($children[$vid][$child]) {
$tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth));
}
} }
} }
} }
......
...@@ -624,16 +624,18 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) { ...@@ -624,16 +624,18 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) {
} }
$max_depth = (is_null($max_depth)) ? count($children[$vid]) : $max_depth; $max_depth = (is_null($max_depth)) ? count($children[$vid]) : $max_depth;
foreach ($children[$vid][$parent] as $child) { if ($children[$vid][$parent]) {
if ($max_depth > $depth) { foreach ($children[$vid][$parent] as $child) {
$terms[$vid][$child]->depth = $depth; if ($max_depth > $depth) {
// The "parent" attribute is not useful, as it would show one parent only. $terms[$vid][$child]->depth = $depth;
unset($terms[$vid][$child]->parent); // The "parent" attribute is not useful, as it would show one parent only.
$terms[$vid][$child]->parents = $parents[$vid][$child]; unset($terms[$vid][$child]->parent);
$tree[] = $terms[$vid][$child]; $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)); if ($children[$vid][$child]) {
$tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth));
}
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment