You are here

function workflow_transition_form_submit in Workflow 7.2

Submit callback function for the Workflow Form / DefaultWidget.

Validate target state and either save a transition immediately or schedule a transition to be executed later by cron.

3 calls to workflow_transition_form_submit()
WorkflowDefaultWidget::submit in includes/Field/WorkflowDefaultWidget.php
Implements workflow_transition() -> WorkflowDefaultWidget::submit().
workflownode_comment_update in workflow_node/workflownode.module
Implements hook_comment_update().
workflownode_node_update in workflow_node/workflownode.module
Implements hook_node_update().
2 string references to 'workflow_transition_form_submit'
workflow_transition_form in ./workflow.form.inc
workflow_transition_wrapper_form in ./workflow.form.inc
Form builder. Allow workflow comment change from menu item/Views link.

File

./workflow.form.inc, line 223
Contains helper functions for WorkflowTransitionForm.

Code

function workflow_transition_form_submit($form, &$form_state) {

  // Retrieve the data from the form.
  if (isset($form_state['values']['workflow_field'])) {

    // If $entity filled: We are on a Entity View page or Workflow History Tab page.
    // If $entity empty: We are on an Advanced Action page.
    $field = $form_state['values']['workflow_field'];
    $instance = $form_state['values']['workflow_instance'];
    $entity_type = $form_state['values']['workflow_entity_type'];
    $entity = $form_state['values']['workflow_entity'];
    $items = array();
    $transition_form = new WorkflowTransitionForm($field, $instance, $entity_type, $entity);
    return $transition_form
      ->submitForm($form, $form_state, $items);
  }
  else {
    watchdog('workflow', 'workflow_transition_form_submit() is called with error.');

    // We are on an Entity/Node/Comment Form page.
    // We should not be here.
    return;
  }
}