function taxonomy_get_parents_all

You are here

7 taxonomy.module taxonomy_get_parents_all($tid)
4.6 taxonomy.module taxonomy_get_parents_all($tid)
4.7 taxonomy.module taxonomy_get_parents_all($tid)
5 taxonomy.module taxonomy_get_parents_all($tid)
6 taxonomy.module taxonomy_get_parents_all($tid)

Find all ancestors of a given term ID.

2 calls to taxonomy_get_parents_all()
forum_page in modules/forum.module
Menu callback; prints a forum listing.
forum_view in modules/forum.module
Implementation of hook_view().

File

modules/taxonomy.module, line 831
Enables the organization of content into categories.

Code

function taxonomy_get_parents_all($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;
}