diff options
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index b60fd1c89..5bed8bb16 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -437,6 +437,20 @@ function taxonomy_get_parents($tid, $key = "tid") { } } +// Gets all parents, parents of parents, etc. +function taxonomy_get_parents_all($tid, $key = "tid") { + $parents = array(); + if ($tid) { + $parents[] = taxonomy_get_term($tid); + $n = 0; + while ($parent = taxonomy_get_parents($parents[$n]->tid)) { + $parents = array_merge($parents, $parent); + $n++; + } + } + return $parents; +} + // hierarchy: get children function taxonomy_get_children($tid, $vid = 0, $key = "tid") { if ($vid) { |