block_box_delete

Versions
4.6 – 5
block_box_delete($bid = 0)
6
block_box_delete(&$form_state, $bid = 0)

Menu callback; confirm and delete custom blocks.

Code

modules/block.module, line 331

<?php
function block_box_delete($bid = 0) {
  $op = $_POST['op'];
  $box = block_box_get($bid);
  $info = $box['info'] ? $box['info'] : $box['title'];

  if ($_POST['edit']['confirm']) {
    db_query('DELETE FROM {boxes} WHERE bid = %d', $bid);
    drupal_set_message(t('The block %name has been deleted.', array('%name' => theme('placeholder', $info))));
    cache_clear_all();
    drupal_goto('admin/block');
  }
  else {
    $output = theme('confirm',
                    t('Are you sure you want to delete the block %name?', array('%name' => theme('placeholder', $info))),
                    'admin/block',
                    NULL,
                    t('Delete'));
  }

  print theme('page', $output);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.