You are here

function themekey_taxonomy_nid2vid in ThemeKey 6

Same name and namespace in other branches
  1. 6.2 modules/themekey.taxonomy.inc \themekey_taxonomy_nid2vid()
1 string reference to 'themekey_taxonomy_nid2vid'
themekey_taxonomy_themekey_properties in modules/themekey.taxonomy.inc

File

modules/themekey.taxonomy.inc, line 68

Code

function themekey_taxonomy_nid2vid($nid, $object = NULL) {
  $vid = array();
  if (is_array($object) && isset($object['#raw']['taxonomy'])) {
    foreach ($object['#raw']['taxonomy'] as $term) {
      $vid[] = $term->vid;
    }
  }
  else {
    $result = db_query('SELECT td.vid FROM {term_data} td INNER JOIN {term_node} tn ON td.tid = tn.tid WHERE tn.nid = %d', $nid);
    while ($term = db_fetch_object($result)) {
      $vid[] = $term->vid;
    }
  }
  return count($vid) ? $vid : FALSE;
}