summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-05-31 19:14:43 +0000
committerDries Buytaert <dries@buytaert.net>2004-05-31 19:14:43 +0000
commit7a33d9f6fdca098b75acb8576147474cff5dd2a8 (patch)
treebe95a69ba30663fecb926874822c4573c4b05df9 /modules
parentfd4d894340442bfb4424ee3538f61650a264faf0 (diff)
downloadbrdo-7a33d9f6fdca098b75acb8576147474cff5dd2a8.tar.gz
brdo-7a33d9f6fdca098b75acb8576147474cff5dd2a8.tar.bz2
- Patch #7350 by Mathias: return part a taxonomy tree to a user-defined
depth/level. - Updated CHANGELOG.txt.
Diffstat (limited to 'modules')
-rw-r--r--modules/comment.module2
-rw-r--r--modules/comment/comment.module2
-rw-r--r--modules/path.module2
-rw-r--r--modules/path/path.module2
-rw-r--r--modules/taxonomy.module15
-rw-r--r--modules/taxonomy/taxonomy.module15
6 files changed, 22 insertions, 16 deletions
diff --git a/modules/comment.module b/modules/comment.module
index f51194c0b..86ac2d363 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -225,7 +225,7 @@ function comment_reply($pid, $nid) {
function comment_validate_form($edit) {
global $user;
-
+
/*
** Validate the comment's body.
*/
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index f51194c0b..86ac2d363 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -225,7 +225,7 @@ function comment_reply($pid, $nid) {
function comment_validate_form($edit) {
global $user;
-
+
/*
** Validate the comment's body.
*/
diff --git a/modules/path.module b/modules/path.module
index a33c524e9..5ac3cc982 100644
--- a/modules/path.module
+++ b/modules/path.module
@@ -303,7 +303,7 @@ function path_save($edit) {
}
drupal_set_message(t('the alias has been saved.'));
-
+
return path_overview();
}
}
diff --git a/modules/path/path.module b/modules/path/path.module
index a33c524e9..5ac3cc982 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -303,7 +303,7 @@ function path_save($edit) {
}
drupal_set_message(t('the alias has been saved.'));
-
+
return path_overview();
}
}
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 99b3460f9..cb425eb53 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -462,7 +462,7 @@ function taxonomy_get_children($tid, $vid = 0, $key = "tid") {
}
// hierarchy: get whole family, with tid, parent and depth; useful to show
-function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $key = "tid") {
+function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $max_depth = NULL) {
static $children, $parents, $terms;
$depth++;
@@ -479,14 +479,17 @@ function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $key = "tid
}
}
+ $max_depth = ($max_depth == '') ? count($children[$vocabulary_id]) : $max_depth;
if ($children[$vocabulary_id][$parent]) {
foreach ($children[$vocabulary_id][$parent] as $child) {
- $terms[$vocabulary_id][$child]->depth = $depth;
- unset($terms[$vocabulary_id][$child]->parent); // this is not useful as it would show one parent only
- $terms[$vocabulary_id][$child]->parents = $parents[$vocabulary_id][$child];
- $tree[] = $terms[$vocabulary_id][$child];
+ if ($max_depth > $depth) {
+ $terms[$vocabulary_id][$child]->depth = $depth;
+ unset($terms[$vocabulary_id][$child]->parent); // this is not useful as it would show one parent only
+ $terms[$vocabulary_id][$child]->parents = $parents[$vocabulary_id][$child];
+ $tree[] = $terms[$vocabulary_id][$child];
- $tree = array_merge($tree, taxonomy_get_tree($vocabulary_id, $child, $depth));
+ $tree = array_merge($tree, taxonomy_get_tree($vocabulary_id, $child, $depth, $max_depth));
+ }
}
}
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 99b3460f9..cb425eb53 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -462,7 +462,7 @@ function taxonomy_get_children($tid, $vid = 0, $key = "tid") {
}
// hierarchy: get whole family, with tid, parent and depth; useful to show
-function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $key = "tid") {
+function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $max_depth = NULL) {
static $children, $parents, $terms;
$depth++;
@@ -479,14 +479,17 @@ function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $key = "tid
}
}
+ $max_depth = ($max_depth == '') ? count($children[$vocabulary_id]) : $max_depth;
if ($children[$vocabulary_id][$parent]) {
foreach ($children[$vocabulary_id][$parent] as $child) {
- $terms[$vocabulary_id][$child]->depth = $depth;
- unset($terms[$vocabulary_id][$child]->parent); // this is not useful as it would show one parent only
- $terms[$vocabulary_id][$child]->parents = $parents[$vocabulary_id][$child];
- $tree[] = $terms[$vocabulary_id][$child];
+ if ($max_depth > $depth) {
+ $terms[$vocabulary_id][$child]->depth = $depth;
+ unset($terms[$vocabulary_id][$child]->parent); // this is not useful as it would show one parent only
+ $terms[$vocabulary_id][$child]->parents = $parents[$vocabulary_id][$child];
+ $tree[] = $terms[$vocabulary_id][$child];
- $tree = array_merge($tree, taxonomy_get_tree($vocabulary_id, $child, $depth));
+ $tree = array_merge($tree, taxonomy_get_tree($vocabulary_id, $child, $depth, $max_depth));
+ }
}
}