function state_flow_node_submit in State Machine 7.3
Implements hook_node_submit().
File
- modules/
state_flow/ state_flow.module, line 714 - An implementation of node revision workflow for Drupal based on the State Machine system.
Code
function state_flow_node_submit($node, $form, &$form_state) {
if (!empty($form_state['values']['state_flow'])) {
/** @var StateFlowNode $machine */
$machine = $form_state['values']['state_flow'];
/** @var StateMachine_Event $event */
$event = $machine
->get_event($form_state['values']['event']);
if (!is_object($event) || !method_exists($event, 'get_options')) {
watchdog('state_flow', 'Invalid event value "@value" submitted in node form.', array(
'@value' => $form_state['values']['event'],
), WATCHDOG_ERROR);
return;
}
$machine
->history_entity_form_submit_build_entity($form, $form_state);
// If this isn't the active published revision we redirect to the revision
// view page - this should avoid confusion when working with revisions.
if (!empty($node->nid) && !empty($node->vid) && !$machine
->isActivePublishedRevision() && empty($_GET['destination'])) {
// We set the get param because we can't set $form_state['redirect'] - the
// node form handler overwrites this value by default.
$_GET['destination'] = 'node/' . $node->nid . '/revisions/' . $node->vid . '/view';
}
}
}