You are here

function themekey_workbench_access_nid2access_id in ThemeKey 7.3

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

src: node:nid dst: workbench_access:access_id

Parameters

$nid: a node id

Return value

int or NULL if no value could be mapped

1 string reference to 'themekey_workbench_access_nid2access_id'
themekey_workbench_access_themekey_properties in modules/themekey.workbench_access.inc
Implements hook_themekey_properties().

File

modules/themekey.workbench_access.inc, line 63
Integrates Workbench Access module into ThemeKey.

Code

function themekey_workbench_access_nid2access_id($nid) {
  $aids = array();
  $query = db_select('workbench_access_node', 'wban');
  $query
    ->addField('wban', 'access_id');
  $query
    ->condition('wban.nid', $nid);
  $result = $query
    ->execute();
  foreach ($result as $item) {
    $aids[] = $item->access_id;
  }
  return count($aids) ? $aids : NULL;
}