You are here

function multiblock_delete in MultiBlock 7

Same name and namespace in other branches
  1. 5 multiblock.module \multiblock_delete()
  2. 6 multiblock.module \multiblock_delete()

Delete a multiblock instance.

1 call to multiblock_delete()
multiblock_delete_form_submit in ./multiblock.module

File

./multiblock.module, line 284
Enhances the block API, as provided by D7 Core.

Code

function multiblock_delete($multiblock_delta) {

  // Remove instance from multiblock's storage.
  $num_deleted = db_delete('multiblock')
    ->condition('delta', (int) $multiblock_delta)
    ->execute();

  // Remove block instances from the block modules tables to avoid orphans.
  db_delete('block')
    ->condition('module', 'multiblock')
    ->condition('delta', (int) $multiblock_delta)
    ->execute();
  db_delete('block_role')
    ->condition('module', 'multiblock')
    ->condition('delta', (int) $multiblock_delta)
    ->execute();
  if (ctype_digit($multiblock_delta) && $num_deleted) {
    _block_rehash();
    return TRUE;
  }
  else {
    return FALSE;
  }
}