You are here

function state_flow_events_revision_submit in State Machine 7.2

Same name and namespace in other branches
  1. 7 modules/state_flow/state_flow.pages.inc \state_flow_events_revision_submit()

Form submission callback for state_flow_events_revision.

File

modules/state_flow/state_flow.pages.inc, line 257

Code

function state_flow_events_revision_submit($form, &$form_state) {
  $node_revision = $form_state['values']['node_revision'];
  $state_flow = $form_state['values']['state_flow'];
  $event = $form_state['values']['event'];
  $event_comment = $form_state['values']['event_comment'];
  if (!empty($event) && !empty($event_comment)) {
    global $user;
    $rv = $state_flow
      ->fire_event($event, $user->uid, $event_comment);
    if ($rv !== FALSE) {
      $state = $state_flow
        ->get_current_state();
      drupal_set_message(t('%title transitioned to the @state state.', array(
        '%title' => $node_revision->title,
        '@state' => $state,
      )));
      $form_state['redirect'] = 'node/' . $node_revision->nid . '/workflow';
    }
  }
}