You are here

function workbench_workflows_select_workflow in Workbench Moderation 7.2

Return the appropriate workflow for a node.

1 call to workbench_workflows_select_workflow()
workbench_workflows_state_flow_entity_machine_type_alter in modules/workbench_workflows/workbench_workflows.module
Implements hook_state_flow_machine_type_alter().

File

modules/workbench_workflows/workbench_workflows.state_flow_entity.inc, line 119
Helper function for hook_state_flow_entity_plugins().

Code

function workbench_workflows_select_workflow($entity) {
  $workflows = workbench_workflows_load_enabled('workflows');
  foreach ($workflows as $workflow) {
    if (workbench_workflows_exportable_access($entity, $workflow, 'workflows')) {

      // Return the first workflow for which access returns TRUE.
      return $workflow;
    }
  }
  return FALSE;
}