function workflow_execute_transition in Workflow 7
Same name and namespace in other branches
- 8 workflow.module \workflow_execute_transition()
- 5.2 workflow.module \workflow_execute_transition()
- 5 workflow.module \workflow_execute_transition()
- 6.2 workflow.module \workflow_execute_transition()
- 6 workflow.module \workflow_execute_transition()
- 7.2 workflow.module \workflow_execute_transition()
Execute a transition (change state of a node). @deprecated: workflow_execute_transition() --> WorkflowTransition::execute().
Parameters
$entity:
$sid: Target state ID.
$comment: A comment for the node's workflow history.
$force: If set to TRUE, workflow permissions will be ignored.
array $field: A field_info data structure, used when changing a Workflow Field
$old_sid: The current/old State ID. Passed if known by caller. @todo: D8: make $old_sid parameter required.
Return value
int ID of new state.
2 calls to workflow_execute_transition()
- workflow_revert_form_submit in workflow_revert/
workflow_revert.module - _workflow_node_initialize_nodes in workflow_admin_ui/
workflow_admin_ui.module - Initialize all pre-existing nodes of a type to their first state. @todo: adjust _workflow_node_initialize_nodes() to handle Workflow Field.
File
- ./
workflow.module, line 421 - Support workflows made up of arbitrary states.
Code
function workflow_execute_transition($entity, $new_sid, $comment = NULL, $force = FALSE, $old_sid = 0, $entity_type = 'node', $field_name = '') {
global $user;
// I think this happens because of Workflow Extensions;
// it seems to be okay to ignore it.
if (empty($entity->nid)) {
return $old_sid;
}
$old_sid = $old_sid ? $old_sid : workflow_node_current_state($entity, $entity_type, $field_name);
$transition = new WorkflowTransition($entity_type, $entity, $field_name, $old_sid, $new_sid, $user->uid, REQUEST_TIME, $comment);
$new_sid = $transition
->execute($force);
return $new_sid;
}