You are here

function workflow_workflow in Workflow 5

Same name and namespace in other branches
  1. 5.2 workflow.module \workflow_workflow()

Implementation of hook_workflow().

File

./workflow.module, line 609

Code

function workflow_workflow($op, $old_state, $new_state, $node) {
  switch ($op) {
    case 'transition pre':
      break;
    case 'transition post':

      // a transition has occurred; fire off actions associated with this transition
      // an SQL guru could clean this up with a complicated JOIN
      $tid = workflow_get_transition_id($old_state, $new_state);
      if ($tid) {
        $actions_this_tid = workflow_get_actions($tid);
        if ($actions_this_tid && function_exists('actions_do')) {
          actions_do(array_keys($actions_this_tid), $node);
        }
      }
      break;
  }
}