function hs_taxonomy_get_parents_all in Hierarchical Select 6.3
Same name and namespace in other branches
- 5.3 modules/hs_taxonomy.module \hs_taxonomy_get_parents_all()
- 7.3 modules/hs_taxonomy.module \hs_taxonomy_get_parents_all()
Alternative version of taxonomy_get_parents_all(): instead of using all parents of a term (i.e. when multiple parents are being used), only the first is kept.
1 call to hs_taxonomy_get_parents_all()
- hs_taxonomy_hierarchical_select_lineage in modules/
hs_taxonomy.module - Implementation of hook_hierarchical_select_lineage().
File
- modules/
hs_taxonomy.module, line 461 - Implementation of the Hierarchical Select API for the Taxonomy module.
Code
function hs_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, array(
reset($parent),
));
$n++;
}
}
return $parents;
}