Same name and namespace in other branches
  1. 4.7.x modules/taxonomy.module \taxonomy_get_parents_all()
  2. 5.x modules/taxonomy/taxonomy.module \taxonomy_get_parents_all()
  3. 6.x modules/taxonomy/taxonomy.module \taxonomy_get_parents_all()
  4. 7.x modules/taxonomy/taxonomy.module \taxonomy_get_parents_all()

Find all ancestors of a given term ID.

1 call to taxonomy_get_parents_all()
forum_page in modules/forum.module
Menu callback; prints a forum listing.

File

modules/taxonomy.module, line 554
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;
}