function menu_block_delete_submit in Menu Block 6.2
Same name and namespace in other branches
- 5.2 menu_block.admin.inc \menu_block_delete_submit()
Deletion of menu blocks.
File
- ./
menu_block.admin.inc, line 71 - Provides infrequently used functions for menu_block.
Code
function menu_block_delete_submit($form, &$form_state) {
// Remove the menu block configuration variables.
$delta = $form_state['values']['delta'];
$block_ids = variable_get('menu_block_ids', array());
unset($block_ids[array_search($delta, $block_ids)]);
sort($block_ids);
variable_set('menu_block_ids', $block_ids);
variable_del("menu_block_{$delta}_title_link");
variable_del("menu_block_{$delta}_admin_title");
variable_del("menu_block_{$delta}_parent");
variable_del("menu_block_{$delta}_level");
variable_del("menu_block_{$delta}_follow");
variable_del("menu_block_{$delta}_depth");
variable_del("menu_block_{$delta}_expanded");
variable_del("menu_block_{$delta}_sort");
db_query("DELETE FROM {blocks} WHERE module = 'menu_block' AND delta = %d", $delta);
db_query("DELETE FROM {blocks_roles} WHERE module = 'menu_block' AND delta = %d", $delta);
drupal_set_message(t('The "%name" block has been removed.', array(
'%name' => $form_state['values']['block_title'],
)));
cache_clear_all();
$form_state['redirect'] = 'admin/build/block';
return;
}