diff options
Diffstat (limited to 'modules/taxonomy')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 79826cc19..83c71e06e 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -646,6 +646,12 @@ function taxonomy_get_parents($tid, $key = 'tid') { * Find all ancestors of a given term ID. */ function taxonomy_get_parents_all($tid) { + $cache = &drupal_static(__FUNCTION__, array()); + + if (isset($cache[$tid])) { + return $cache[$tid]; + } + $parents = array(); if ($term = taxonomy_term_load($tid)) { $parents[] = $term; @@ -655,6 +661,9 @@ function taxonomy_get_parents_all($tid) { $n++; } } + + $cache[$tid] = $parents; + return $parents; } |