You are here

function workflow_actions_workflow in Workflow 7.2

Same name and namespace in other branches
  1. 6.2 workflow_actions/workflow_actions.module \workflow_actions_workflow()
  2. 6 workflow_actions/workflow_actions.module \workflow_actions_workflow()
  3. 7 workflow_actions/workflow_actions.module \workflow_actions_workflow()

Implements hook_workflow().

File

workflow_actions/workflow_actions.module, line 48
Enables actions to be fired upon a Workflow State change.

Code

function workflow_actions_workflow($op, $id, $new_sid, $entity, $force = FALSE, $entity_type = 'node', $field_name = '', $transition = NULL) {
  switch ($op) {
    case 'transition post':

      // Reminder: event 'transition post' does not occur for Workflow Field.
      _workflow_actions_do($transition);
      break;
    case 'transition delete':

      // @todo: implement delete triggers upon 'transition delete'.
      // The below code generates an error PDOException: SQLSTATE[42S22].
      // So, it is commented out as per d.o. #2200089. In 7.x-1.2, this trigger
      // was never invoked. So, 'delete trigger upon transition delete' is now
      // a feature request.
      // $tid = $id;
      // $actions = _workflow_actions_get_actions_by_tid($tid);
      // foreach ($actions as $aid) {
      // _workflow_actions_remove($tid, $aid);
      // }
      break;
  }
}