You are here

function workbench_workflows_entity_revision_operation_access in Workbench Moderation 7.2

Implements hook_entity_revision_operation_access().

File

modules/workbench_workflows/workbench_workflows.module, line 374
workbench_workflows.module

Code

function workbench_workflows_entity_revision_operation_access($operation, $entity_type, $entity, $account) {
  if (strpos($operation['operation'], 'workbench_moderation_') !== FALSE && !empty($entity) && $entity_type == 'node') {
    $machine = state_flow_entity_load_state_machine($entity, $entity_type);
    $events = $machine
      ->get_available_events_options(TRUE);
    $event = substr($operation['operation'], 21);

    // Make sure this is a valid transition.
    if (!isset($events[$event])) {
      return FALSE;
    }
  }
}