function taxonomy_node_get_terms in Drupal 5
Same name and namespace in other branches
- 4 modules/taxonomy.module \taxonomy_node_get_terms()
- 6 modules/taxonomy/taxonomy.module \taxonomy_node_get_terms()
Find all terms associated with the given node, ordered by vocabulary and term weight.
2 calls to taxonomy_node_get_terms()
- taxonomy_form_alter in modules/
taxonomy/ taxonomy.module - Implementation of hook_form_alter(). Generate a form for selecting terms to associate with a node.
- taxonomy_nodeapi in modules/
taxonomy/ taxonomy.module - Implementation of hook_nodeapi().
File
- modules/
taxonomy/ taxonomy.module, line 777 - Enables the organization of content into categories.
Code
function taxonomy_node_get_terms($nid, $key = 'tid') {
static $terms;
if (!isset($terms[$nid][$key])) {
$result = db_query(db_rewrite_sql('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name', 't', 'tid'), $nid);
$terms[$nid][$key] = array();
while ($term = db_fetch_object($result)) {
$terms[$nid][$key][$term->{$key}] = $term;
}
}
return $terms[$nid][$key];
}