You are here

function afb_block_delete in Advanced Form Block 7

Deletes a block instance from the block tables.

2 calls to afb_block_delete()
afb_existing_blocks_display_form_submit in ./afb.module
Submit handler for the existing block list form facilitating its deletion.
afb_node_delete in ./afb.module
Implements hook_node_delete().

File

./afb.module, line 561
Allows administrators to create blockd of node add/edit forms.

Code

function afb_block_delete($delta) {
  db_update('block')
    ->fields(array(
    'region' => '-1',
  ))
    ->condition('delta', $delta)
    ->execute();
  db_delete('block_custom')
    ->condition('bid', $delta)
    ->execute();
  db_delete('block')
    ->condition('module', 'afb')
    ->condition('delta', $delta)
    ->execute();
  db_delete('block_role')
    ->condition('module', 'afb')
    ->condition('delta', $delta)
    ->execute();
  $data = afb_get_node_form_block_data($delta);
  drupal_set_message(t('The %name block has been removed.', array(
    '%name' => $data->title,
  )));
  cache_clear_all();
  return;
}