function themekey_taxonomy_nid2tid in ThemeKey 7.3
Same name and namespace in other branches
- 6 modules/themekey.taxonomy.inc \themekey_taxonomy_nid2tid()
- 6.2 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 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 141 - Provides some taxonomy stuff as ThemeKey properties.
Code
function themekey_taxonomy_nid2tid($nid) {
$tids = array();
$query = db_select('taxonomy_index', 't');
$query
->addField('t', 'tid');
$query
->condition('t.nid', $nid);
$result = $query
->execute();
foreach ($result as $item) {
$tids[] = $item->tid;
}
return count($tids) ? $tids : NULL;
}