function block_revisions_revert_confirm_submit in Block Revisions 7
Same name and namespace in other branches
- 6 block_revisions.admin.inc \block_revisions_revert_confirm_submit()
@todo Please document this function.
See also
File
- ./
block_revisions.admin.inc, line 21 - Admin functions and page callbacks for the Block Revisions module.
Code
function block_revisions_revert_confirm_submit($form, &$form_state) {
global $user;
$revision = $form['#block_revision'];
$delta = $revision->bid;
$vid = $revision->vid;
$message = t('Copy of the revision from !date.', array(
'!date' => format_date($revision->timestamp),
));
db_update('block_custom')
->fields(array(
'body' => $revision->body,
'format' => $revision->format,
'uid' => $user->uid,
'timestamp' => REQUEST_TIME,
))
->condition('bid', $delta)
->execute();
block_revisions_create_revision($delta, $revision->body, $revision->format, $message);
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}";
}
}