You are here

function taxonomy_term_depth_get_parents in Taxonomy Term Depth 7

Same name and namespace in other branches
  1. 8.2 taxonomy_term_depth.module \taxonomy_term_depth_get_parents()
  2. 8 taxonomy_term_depth.module \taxonomy_term_depth_get_parents()

Get parents of the term.

Parameters

$tid:

Return value

array

3 calls to taxonomy_term_depth_get_parents()
taxonomy_term_depth_get_chain in ./taxonomy_term_depth.module
taxonomy_term_depth_get_full_chain in ./taxonomy_term_depth.module
Gets full chain of terms, including term itself
taxonomy_term_depth_handler_field_taxonomy::render_link in includes/taxonomy_term_depth_handler_field_taxonomy.inc
Find the parent at the desired depth if available. Render whatever the data is as a link to the taxonomy.

File

./taxonomy_term_depth.module, line 153
Provides some custom functionality.

Code

function taxonomy_term_depth_get_parents($tid, $reversed = FALSE) {

  // @todo: Caching parents or not worth?
  $parents = array();
  $parent = $tid;
  while ($parent = taxonomy_term_depth_get_parent($parent)) {
    $parents[] = $parent;
  }
  return $reversed ? array_reverse($parents) : $parents;
}