function taxonomy_get_parents
7.x taxonomy.module | taxonomy_get_parents($tid) |
6.x taxonomy.module | taxonomy_get_parents($tid, $key = 'tid') |
Find all parents of a given term ID.
5 calls to taxonomy_get_parents()
- taxonomy_del_term in drupal-6.x/
modules/ taxonomy/ taxonomy.module - Delete a term.
- taxonomy_form_term in drupal-6.x/
modules/ taxonomy/ taxonomy.admin.inc - Form function for the term edit form.
- taxonomy_get_parents_all in drupal-6.x/
modules/ taxonomy/ taxonomy.module - Find all ancestors of a given term ID.
- taxonomy_term_page in drupal-6.x/
modules/ taxonomy/ taxonomy.pages.inc - Menu callback; displays all nodes associated with a term.
- _forum_parent_select in drupal-6.x/
modules/ forum/ forum.admin.inc - Returns a select box for available parent terms
File
- drupal-6.x/
modules/ taxonomy/ taxonomy.module, line 779 - Enables the organization of content into categories.
Code
function taxonomy_get_parents($tid, $key = 'tid') {
if ($tid) {
$result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON h.parent = t.tid WHERE h.tid = %d ORDER BY weight, name', 't', 'tid'), $tid);
$parents = array();
while ($parent = db_fetch_object($result)) {
$parents[$parent->$key] = $parent;
}
return $parents;
}
else {
return array();
}
}