Same name and namespace in other branches
  1. 4.7.x modules/taxonomy.module \taxonomy_node_get_terms()
  2. 5.x modules/taxonomy/taxonomy.module \taxonomy_node_get_terms()
  3. 6.x modules/taxonomy/taxonomy.module \taxonomy_node_get_terms()

Find all terms associated to the given node.

4 calls to taxonomy_node_get_terms()
forum_form in modules/forum.module
Implementation of hook_form().
forum_validate in modules/forum.module
Implementation of hook_validate().
taxonomy_node_form in modules/taxonomy.module
Generate a form for selecting terms to associate with a node.
taxonomy_rss_item in modules/taxonomy.module
Provides category information for rss feeds

File

modules/taxonomy.module, line 475
Enables the organization of content into categories.

Code

function taxonomy_node_get_terms($nid, $key = 'tid') {
  static $terms;
  if (!isset($terms[$nid])) {
    $result = db_query('SELECT t.* FROM {term_data} t, {term_node} r WHERE r.tid = t.tid AND r.nid = %d ORDER BY weight, name', $nid);
    $terms[$nid] = array();
    while ($term = db_fetch_object($result)) {
      $terms[$nid][$term->{$key}] = $term;
    }
  }
  return $terms[$nid];
}