function imageblock_delete_block_form_submit in Image Block 6
Deletion of image blocks.
File
- ./
imageblock.module, line 294 - imageblock.module Primarily Drupal hooks.
Code
function imageblock_delete_block_form_submit($form, &$form_state) {
$delta = $form_state['values']['delta'];
// Delete the associated file
$file = imageblock_get_file($delta);
if (!empty($file->fid)) {
file_delete($file->filepath);
db_query('DELETE FROM {files} WHERE fid = %d', $file->fid);
}
db_query("DELETE FROM {imageblock} WHERE bid = %d", $delta);
db_query("DELETE FROM {blocks_roles} WHERE module = 'imageblock' AND delta = %d", $delta);
db_query("DELETE FROM {blocks} WHERE module = 'imageblock' AND delta = %d", $delta);
drupal_set_message(t('The image block "%name" has been removed.', array(
'%name' => $form_state['values']['block_title'],
)));
cache_clear_all();
$form_state['redirect'] = 'admin/build/block';
return;
}