You are here

function _revisioning_form_submit in Revisioning 6.3

Same name and namespace in other branches
  1. 8 revisioning.pages.inc \_revisioning_form_submit()
  2. 6.4 revisioning.pages.inc \_revisioning_form_submit()
  3. 7 revisioning.pages.inc \_revisioning_form_submit()

Handler for the 'Save' button on the edit form.

When saving a new revision we shouldn't redirect to "View current", as that's not the one we've saved. However at this stage, via the form, we don't know the vid of the newly created revision, only the vid of the revision we've just edited, so we get latest revision id from the database.

1 string reference to '_revisioning_form_submit'
revisioning_form_alter in ./revisioning.pages.inc
Implementation of hook_form_alter().

File

./revisioning.pages.inc, line 295
Rendering and altering of pages and forms used by Revisioning

Code

function _revisioning_form_submit($form, &$form_state) {
  if (isset($form['#node']->nid)) {
    $nid = $form['#node']->nid;

    // Don't use $form_state['nid'], will NOT be empty for a new node
    // Don't redirect when creating new node or when the displayed vid is the current
    if (($vid = revisioning_get_latest_revision_id($nid)) && $vid != node_tools_get_current_node_revision_id($nid)) {
      $form_state['redirect'] = "node/{$nid}/revisions/{$vid}/view";
    }
  }
}