function block_delete in Patterns 7.2
Wraps several a call to drupal_form_submit to delete the settings of a block. This operation is only available for custom blocks (as well as it happens in the UI) since blocks created by custom modules cannot be deleted (only disabled through status)
Parameters
string $form_id String containing the form ID. In the case of custom functions the value is empty.:
array $form_state Set of values after parsing the action.:
2 string references to 'block_delete'
- block_patterns in patterns_components/
components/ block.inc - block_patterns_cleanup in patterns_components/
components/ block.inc - Implements hook_patterns_cleanup().
File
- patterns_components/
components/ block.inc, line 554
Code
function block_delete($form_id, &$form_state) {
//This operation is only available for custom modules, and we need to delete
//the information for all the tables
db_delete('block_custom')
->condition('bid', $form_state['values']['delta'])
->execute();
db_delete('block')
->condition('module', $form_state['values']['module'])
->condition('delta', $form_state['values']['delta'])
->execute();
db_delete('block_role')
->condition('module', $form_state['values']['module'])
->condition('delta', $form_state['values']['delta'])
->execute();
$msg = t('Removed all the configuration for custom block delta %delta.', array(
'%delta' => $form_state['values']['delta'],
));
return patterns_results(PATTERNS_SUCCESS, $msg);
}