You are here

function nat_get_terms in Node Auto Term [NAT] 5

Same name and namespace in other branches
  1. 6.2 nat.module \nat_get_terms()
  2. 6 nat.module \nat_get_terms()
  3. 7.2 nat.module \nat_get_terms()
  4. 7 nat.module \nat_get_terms()

Gets terms associated with a node.

Parameters

$nid: The nid of the node whose NAT terms are to be retrieved.

Return value

$return An associative array of NAT-associated term objects.

4 calls to nat_get_terms()
nat_get_term in ./nat.module
Retrieve the first / single NAT term associated with a node optionally restricted by vocabulary.
nat_get_terms_by_vocabulary in ./nat.module
Retrieve the NAT terms associated with a node restricted by vocabulary.
nat_nodeapi in ./nat.module
Implementation of hook_nodeapi().
_nat_delete_terms in ./nat.module
Delete associated terms from the taxonomy system. @todo Options to delete child nodes as well etc.

File

./nat.module, line 329
NAT - node auto term - is a helper module that automatically creates a term using the same title as a node.

Code

function nat_get_terms($nid) {
  static $term_cache = NULL;
  if (isset($term_cache[$nid])) {
    return $term_cache[$nid];
  }
  $return = array();
  $result = db_query("SELECT td.* FROM {nat} n INNER JOIN {term_data} td USING (tid) WHERE n.nid = %d", $nid);
  while ($term = db_fetch_object($result)) {
    $return[$term->tid] = $term;
  }

  // Cache result.
  $term_cache[$nid] = $return;
  return $return;
}