You are here

function themekey_taxonomy_nid2tid in ThemeKey 6

Same name and namespace in other branches
  1. 6.2 modules/themekey.taxonomy.inc \themekey_taxonomy_nid2tid()
  2. 7.3 modules/themekey.taxonomy.inc \themekey_taxonomy_nid2tid()
  3. 7 modules/themekey.taxonomy.inc \themekey_taxonomy_nid2tid()
  4. 7.2 modules/themekey.taxonomy.inc \themekey_taxonomy_nid2tid()
1 string reference to 'themekey_taxonomy_nid2tid'
themekey_taxonomy_themekey_properties in modules/themekey.taxonomy.inc

File

modules/themekey.taxonomy.inc, line 85

Code

function themekey_taxonomy_nid2tid($nid, $object = NULL) {
  if (is_array($object) && isset($object['#raw']['taxonomy'])) {
    return array_keys($object['#raw']['taxonomy']);
  }
  $tid = array();
  $result = db_query('SELECT tid FROM {term_node} WHERE nid = %d', $nid);
  while ($term = db_fetch_object($result)) {
    $tid[] = $term->tid;
  }
  return count($tid) ? $tid : FALSE;
}