function themekey_taxonomy_nid2vid in ThemeKey 6.2
Same name and namespace in other branches
- 6 modules/themekey.taxonomy.inc \themekey_taxonomy_nid2vid()
ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
src: node:nid dst: taxonomy:vid
Parameters
$nid: node id
Return value
array of taxonomy vocabulary ids or NULL if no value could be mapped
1 string reference to 'themekey_taxonomy_nid2vid'
- themekey_taxonomy_themekey_properties in modules/
themekey.taxonomy.inc - Implements hook_themekey_properties().
File
- modules/
themekey.taxonomy.inc, line 126 - Provides some taxonomy stuff as ThemeKey properties.
Code
function themekey_taxonomy_nid2vid($nid) {
$vid = array();
// TODO use taxonomy API instead of SQL
$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 : NULL;
}