You are here

function menu_block_delete_submit in Menu Block 5.2

Same name and namespace in other branches
  1. 6.2 menu_block.admin.inc \menu_block_delete_submit()

Deletion of menu blocks.

File

./menu_block.admin.inc, line 80
Provides infrequently used functions for menu_block.

Code

function menu_block_delete_submit($form_id, $form_values) {

  // Remove the menu block configuration variables.
  $delta = $form_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}_menu_name");
  variable_del("menu_block_{$delta}_title");
  variable_del("menu_block_{$delta}_level");
  variable_del("menu_block_{$delta}_depth");
  variable_del("menu_block_{$delta}_expanded");
  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_values['block_title'],
  )));
  cache_clear_all();
  return 'admin/build/block';
}