function node_revision_revert_confirm_submit in Drupal 7
Same name and namespace in other branches
- 4 modules/node.module \node_revision_revert_confirm_submit()
- 5 modules/node/node.module \node_revision_revert_confirm_submit()
- 6 modules/node/node.pages.inc \node_revision_revert_confirm_submit()
Form submission handler for node_revision_revert_confirm().
File
- modules/
node/ node.pages.inc, line 635 - Page callbacks for adding, editing, deleting, and revisions management for content.
Code
function node_revision_revert_confirm_submit($form, &$form_state) {
$node_revision = $form['#node_revision'];
$node_revision->revision = 1;
$node_revision->log = t('Copy of the revision from %date.', array(
'%date' => format_date($node_revision->revision_timestamp),
));
node_save($node_revision);
watchdog('content', '@type: reverted %title revision %revision.', array(
'@type' => $node_revision->type,
'%title' => $node_revision->title,
'%revision' => $node_revision->vid,
));
drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array(
'@type' => node_type_get_name($node_revision),
'%title' => $node_revision->title,
'%revision-date' => format_date($node_revision->revision_timestamp),
)));
$form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions';
}