You are here

function _workflow_execute_transitions in Workflow 8

Execute transitions. if prohibited, restore original field value.

  • insert: use hook_insert(), to have the Entity ID determined when saving transitions.
  • update: use hook_presave() to revert executions,
  • so, do not use hook_update().

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An Entity.

2 calls to _workflow_execute_transitions()
workflow_entity_insert in ./workflow.module
Implements hook_entity_insert().
workflow_entity_presave in ./workflow.module
Implements hook_entity_presave().

File

./workflow.module, line 201
Support workflows made up of arbitrary states.

Code

function _workflow_execute_transitions(EntityInterface $entity) {

  // Avoid this hook on workflow objects.
  if (WorkflowManager::isWorkflowEntityType($entity
    ->getEntityTypeId())) {
    return;
  }

  // Execute/save the transitions from the widgets in the entity form.
  WorkflowManager::executeTransitionsOfEntity($entity);
}