You are here

function workbench_access_workbench_block in Workbench Access 7

Implements hook_block_view_workbench_block_alter().

Show the editorial status of this node.

File

./workbench_access.module, line 1897
Workbench Access module file.

Code

function workbench_access_workbench_block() {

  // Add editing information to this page (if it's a node).
  if ($node = menu_get_object()) {
    if (user_access('view workbench access information')) {
      if (!variable_get('workbench_access_node_type_' . $node->type, 1)) {
        return array(
          t('@message_label: <em>@type pages are not under access control</em>', array(
            '@message_label' => variable_get('workbench_access_label', 'Section'),
            '@type' => node_type_get_name($node->type),
          )),
        );
      }
      elseif (empty($node->workbench_access)) {
        return array(
          t('@message_label: <em>Unassigned</em>', array(
            '@message_label' => variable_get('workbench_access_label', 'Section'),
          )),
        );
      }
      else {
        $names = array();
        $access_type = variable_get('workbench_access');
        foreach ($node->workbench_access as $access_id) {
          $section = workbench_access_load($access_type, $access_id);
          $names[] = $section['name'];
        }
        return array(
          t('@message_label: %section', array(
            '@message_label' => variable_get('workbench_access_label', 'Section'),
            '%section' => implode(', ', $names),
          )),
        );
      }
    }
  }
}