You are here

function workflow_actions_entity_update in Workflow 7.2

Implements hook_entity_update().

See also

WorkflowTransition->execute()

1 call to workflow_actions_entity_update()
workflow_actions_entity_insert in workflow_actions/workflow_actions.module
Implements hook_entity_insert().

File

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

Code

function workflow_actions_entity_update($entity, $entity_type) {

  // For workflow_field, the 'transition post' event is not triggered in
  // WorkflowTransition->execute(), since we are still IN a transition.
  // This is now triggered here.
  // (But without hook_workflow, since it crashes workflow_access.)
  // P.S. You should not mix workflow field and workflow node!!
  if (module_exists('workflowfield') && !module_exists('workflownode')) {
    if (isset($entity->workflow_transitions)) {
      foreach ($entity->workflow_transitions as &$transition) {

        // $transition->post_execute(); // equivalent with hook_entity_save().
        _workflow_actions_do($transition);
      }
    }
  }
  elseif (module_exists('workflownode')) {

    // This is already done in workflow_actions_workflow(). But we cannot move
    // that here, since node_save()/entity_save() isn't always triggered.
  }
}