function taxonomy_xml_get_term_ancestors in Taxonomy import/export via XML 7
Same name and namespace in other branches
- 6.2 taxonomy_xml.module \taxonomy_xml_get_term_ancestors()
Return a list of all terms in the ancestry chain of the given term.
List list includes all parents from multi-inheritance.
Use this to check before setting up a parental chain that may loop
Return value
array keyed by tid, but in no specific order.
See also
1 call to taxonomy_xml_get_term_ancestors()
- taxonomy_xml_set_term_relations in ./
taxonomy_xml.process.inc - Given a list of terms, set the related-terms and structure, and save again.
File
- ./
taxonomy_xml.process.inc, line 966 - The workhorse processes for importing taxonomies.
Code
function taxonomy_xml_get_term_ancestors($tid) {
$parents = taxonomy_get_parents_all($tid);
// index by tid.
$ancestors = array();
foreach ($parents as $parent) {
$ancestors[$parent->tid] = $parent;
}
return $ancestors;
}