You are here

function themekey_taxonomy_vid2tid in ThemeKey 6.3

Same name and namespace in other branches
  1. 6.4 modules/themekey.taxonomy.inc \themekey_taxonomy_vid2tid()

ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).

src: node:vid dst: taxonomy:tid

Parameters

$node_vid: node version id

Return value

array of taxonomy term ids or NULL if no value could be mapped

1 call to themekey_taxonomy_vid2tid()
themekey_taxonomy_vid2tid_and_parents in modules/themekey.taxonomy.inc
ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
1 string reference to 'themekey_taxonomy_vid2tid'
themekey_taxonomy_themekey_properties in modules/themekey.taxonomy.inc
Implements hook_themekey_properties().

File

modules/themekey.taxonomy.inc, line 155
Provides some taxonomy stuff as ThemeKey properties.

Code

function themekey_taxonomy_vid2tid($node_vid) {
  $tid = array();

  // Use SQL instead taxonomy API because this code runs during hook_init() stage.
  // Using taxonomy API will require to load the node using node_load() which is not allowed in this stage.
  $result = db_query('SELECT tid FROM {term_node} WHERE vid = %d', $node_vid);
  while ($term = db_fetch_object($result)) {
    $tid[] = $term->tid;
  }
  return count($tid) ? $tid : NULL;
}