node_revision_revert_confirm_submit

5 node.module node_revision_revert_confirm_submit($form_id, $form_values)
6 node.pages.inc node_revision_revert_confirm_submit($form, &$form_state)
7 node.pages.inc node_revision_revert_confirm_submit($form, &$form_state)
8 node.pages.inc node_revision_revert_confirm_submit($form, &$form_state)

File

modules/node/node.module, line 1787
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

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