function taxonomy_node_get_terms in Drupal 6
Same name and namespace in other branches
- 4 modules/taxonomy.module \taxonomy_node_get_terms()
- 5 modules/taxonomy/taxonomy.module \taxonomy_node_get_terms()
Find all terms associated with the given node, ordered by vocabulary and term weight.
3 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. We check for taxonomy_override_selector before loading the full vocabulary, so contrib modules can intercept before hook_form_alter and provide scalable…
- taxonomy_nodeapi in modules/
taxonomy/ taxonomy.module - Implementation of hook_nodeapi().
- taxonomy_node_save in modules/
taxonomy/ taxonomy.module - Save term associations for a given node.
File
- modules/
taxonomy/ taxonomy.module, line 632 - Enables the organization of content into categories.
Code
function taxonomy_node_get_terms($node, $key = 'tid', $reset = FALSE) {
static $terms;
if ($reset) {
unset($terms[$node->vid]);
}
if (!isset($terms[$node->vid][$key])) {
$result = db_query(db_rewrite_sql('SELECT t.*,v.weight AS v_weight_unused 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.vid = %d ORDER BY v.weight, t.weight, t.name', 't', 'tid'), $node->vid);
$terms[$node->vid][$key] = array();
while ($term = db_fetch_object($result)) {
$terms[$node->vid][$key][$term->{$key}] = $term;
}
}
return $terms[$node->vid][$key];
}