function menu_block_delete in Menu Block 7.3
Same name and namespace in other branches
- 5.2 menu_block.module \menu_block_delete()
- 6.2 menu_block.admin.inc \menu_block_delete()
- 7.2 menu_block.module \menu_block_delete()
Delete a menu block.
Parameters
string $delta: The delta of the menu block.
2 calls to menu_block_delete()
- menu_block_delete_form_submit in ./
menu_block.admin.inc - Deletion of menu blocks.
- menu_block_menu_delete in ./
menu_block.module - Implements hook_menu_delete().
File
- ./
menu_block.module, line 965 - Provides configurable blocks of menu items.
Code
function menu_block_delete($delta) {
// Since this used to be a form callback, prevent unintentional uses.
if (is_array($delta)) {
variable_set('menu_rebuild_needed', TRUE);
return;
}
$block_ids = variable_get('menu_block_ids', array());
$index = array_search($delta, $block_ids);
if ($index !== FALSE && ($config = menu_block_get_config($delta))) {
module_invoke_all('menu_block_delete', $config);
// Remove the delta from the list of custom IDs.
unset($block_ids[$index]);
sort($block_ids);
variable_set('menu_block_ids', $block_ids);
// Remove all the individual variables.
$variable_keys = array_keys(menu_block_default_config());
foreach ($variable_keys as $key) {
variable_del("menu_block_{$delta}_{$key}");
}
}
}