Same name and namespace in other branches
- 4.7.x modules/taxonomy.module \taxonomy_get_parents()
- 5.x modules/taxonomy/taxonomy.module \taxonomy_get_parents()
- 6.x modules/taxonomy/taxonomy.module \taxonomy_get_parents()
- 7.x modules/taxonomy/taxonomy.module \taxonomy_get_parents()
Find all parents of a given term ID.
3 calls to taxonomy_get_parents()
- taxonomy_del_term in modules/
taxonomy.module - taxonomy_form_term in modules/
taxonomy.module - _forum_parent_select in modules/
forum.module - Returns a select box for available parent terms
File
- modules/
taxonomy.module, line 537 - Enables the organization of content into categories.
Code
function taxonomy_get_parents($tid, $key = 'tid') {
if ($tid) {
$result = db_query('SELECT t.* FROM {term_hierarchy} h, {term_data} t WHERE h.parent = t.tid AND h.tid = %d ORDER BY weight, name', $tid);
$parents = array();
while ($parent = db_fetch_object($result)) {
$parents[$parent->{$key}] = $parent;
}
return $parents;
}
else {
return array();
}
}