function block_revisions_delete_confirm_submit in Block Revisions 7
Same name and namespace in other branches
- 6 block_revisions.admin.inc \block_revisions_delete_confirm_submit()
@todo Please document this function.
See also
File
- ./
block_revisions.admin.inc, line 60 - Admin functions and page callbacks for the Block Revisions module.
Code
function block_revisions_delete_confirm_submit($form, &$form_state) {
$revision = $form['#block_revision'];
$delta = $revision->bid;
$vid = $revision->vid;
db_delete('boxes_revisions')
->condition('bid', $delta)
->condition('vid', $vid)
->execute();
$title = db_query("SELECT info FROM {block_custom} WHERE bid = :bid", array(
':bid' => $delta,
))
->fetchField();
watchdog('content', "Deleted revision %revision for custom block '%title'.", array(
'%title' => $title,
'%revision' => $revision->vid,
));
drupal_set_message(t("Revision from %revision-date of custom block '%title' has been deleted.", array(
'%revision-date' => format_date($revision->timestamp),
'%title' => $title,
)));
if (db_query('SELECT COUNT(vid) FROM {boxes_revisions} WHERE bid = :bid', array(
':bid' => $delta,
))
->fetchField() > 1) {
$form_state['redirect'] = "admin/structure/block/manage/block/{$delta}/revisions";
}
else {
$form_state['redirect'] = "admin/structure/block/manage/block/{$delta}";
}
}