function node_revision_delete_confirm_submit in Drupal 7
Same name and namespace in other branches
- 4 modules/node.module \node_revision_delete_confirm_submit()
- 5 modules/node/node.module \node_revision_delete_confirm_submit()
- 6 modules/node/node.pages.inc \node_revision_delete_confirm_submit()
Form submission handler for node_revision_delete_confirm().
File
- modules/
node/ node.pages.inc, line 670 - Page callbacks for adding, editing, deleting, and revisions management for content.
Code
function node_revision_delete_confirm_submit($form, &$form_state) {
$node_revision = $form['#node_revision'];
node_revision_delete($node_revision->vid);
watchdog('content', '@type: deleted %title revision %revision.', array(
'@type' => $node_revision->type,
'%title' => $node_revision->title,
'%revision' => $node_revision->vid,
));
drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array(
'%revision-date' => format_date($node_revision->revision_timestamp),
'@type' => node_type_get_name($node_revision),
'%title' => $node_revision->title,
)));
$form_state['redirect'] = 'node/' . $node_revision->nid;
if (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(
':nid' => $node_revision->nid,
))
->fetchField() > 1) {
$form_state['redirect'] .= '/revisions';
}
}