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