node_revision_revert_confirm_submit

Versions
4.7 – 5
node_revision_revert_confirm_submit($form_id, $form_values)
6 – 7
node_revision_revert_confirm_submit($form, &$form_state)

Code

modules/node/node.module, line 1787

<?php
function node_revision_revert_confirm_submit($form_id, $form_values) {
  $node = $form_values['node'];

  $node->revision = 1;
  $node->log = t('Copy of the revision from %date.', array('%date' => format_date($node->revision_timestamp)));
  if (module_exists('taxonomy')) {
    $node->taxonomy = array_keys($node->taxonomy);
  }

  node_save($node);

  drupal_set_message(t('%title has been reverted back to the revision from %revision-date', array('%revision-date' => format_date($node->revision_timestamp), '%title' => $node->title)));
  watchdog('content', t('@type: reverted %title revision %revision.', array('@type' => t($node->type), '%title' => $node->title, '%revision' => $node->vid)));

  return 'node/'. $node->nid .'/revisions';
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.