function workflow_revert_form_submit in Workflow 7
Same name and namespace in other branches
- 7.2 workflow_revert/workflow_revert.pages.inc \workflow_revert_form_submit()
File
- workflow_revert/
workflow_revert.module, line 67 - Adds an 'Revert' link to the first workflow history row.
Code
function workflow_revert_form_submit($form, $form_state) {
$sid = $form['#sid'];
$nid = $form['#nid'];
$node = $form['#node'];
$comment = t('State reverted.');
// If Rules is available, signal the reversion.
if (module_exists('rules')) {
rules_invoke_event('workflow_state_reverted', $node);
}
// Force the transition because it's probably not valid.
//@todo: use WorkflowTransition->execute() in workflow_revert.
workflow_execute_transition($node, $sid, $comment, TRUE);
drupal_set_message($comment);
drupal_goto('node/' . $form['#nid'] . '/workflow');
}