taxonomy_node_get_terms

Versions
4.6 – 5
taxonomy_node_get_terms($nid, $key = 'tid')
6
taxonomy_node_get_terms($node, $key = 'tid')

Find all terms associated to the given node.

▾ 5 functions call 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_link in modules/taxonomy.module
Implementation of hook_link().
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

Code

modules/taxonomy.module, line 475

<?php
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];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.