function taxonomy_term_depth_get_parents in Taxonomy Term Depth 8
Same name and namespace in other branches
- 8.2 taxonomy_term_depth.module \taxonomy_term_depth_get_parents()
- 7 taxonomy_term_depth.module \taxonomy_term_depth_get_parents()
Get parents of the term.
Parameters
$tid:
Return value
array
2 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
File
- ./
taxonomy_term_depth.module, line 134 - Main module file.
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;
}