From 7d3d5532dfb93d1ed9e04b64e2576312591f1f28 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Thu, 7 Apr 2005 20:09:36 +0000 Subject: [PATCH] - Fixed warning. --- modules/taxonomy.module | 22 ++++++++++++---------- modules/taxonomy/taxonomy.module | 22 ++++++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/modules/taxonomy.module b/modules/taxonomy.module index 150796ff3ba9..d6212fcec79c 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -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; - 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)); + 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]; + + 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 150796ff3ba9..d6212fcec79c 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -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; - 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)); + 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]; + + if ($children[$vid][$child]) { + $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth)); + } } } } -- GitLab