You are here

function _workbench_access_get_node_section_names in Workbench Access 7

Fetch an array of a node's access sections for use with tokens.

Return value

array An array of access section names keyed by access ID.

1 call to _workbench_access_get_node_section_names()
workbench_access_tokens in ./workbench_access.tokens.inc
Implements hook_tokens().
1 string reference to '_workbench_access_get_node_section_names'
workbench_access_node_insert in ./workbench_access.module
Implements hook_node_insert().

File

./workbench_access.tokens.inc, line 173
Token integration for the workbench_access module.

Code

function _workbench_access_get_node_section_names($node) {
  $sections =& drupal_static(__FUNCTION__, array());
  if (!isset($sections[$node->nid])) {
    $sections[$node->nid] = array();
    if (!empty($node->workbench_access)) {
      $access_type = variable_get('workbench_access');
      foreach ($node->workbench_access as $access_id) {
        $info = workbench_access_load($access_type, $access_id);
        $sections[$node->nid][$access_id] = $info['name'];
      }
    }
  }
  return $sections[$node->nid];
}