You are here

function ds_build_mode_delete_form_submit in Display Suite 6.3

Same name and namespace in other branches
  1. 6 includes/ds.buildmodes.inc \ds_build_mode_delete_form_submit()
  2. 6.2 includes/ds.buildmodes.inc \ds_build_mode_delete_form_submit()

Delete build mode.

File

includes/ds.buildmodes.inc, line 234
Manage build modes.

Code

function ds_build_mode_delete_form_submit($form, &$form_state) {
  $module = $form['#module'];
  $build_modes = variable_get($module . '_build_modes', array());
  unset($build_modes[$form_state['values']['display']]);
  variable_set($module . '_build_modes', $build_modes);

  // Remove any settings of build modes from the database.
  db_query("DELETE FROM {ds_settings} WHERE build_mode = '%s' AND module = '%s'", $form_state['values']['display'], $module);
  drupal_set_message(t('Custom build mode %build_mode has been removed.', array(
    '%build_mode' => $form_state['values']['display'],
  )));
  $form_state['redirect'] = DS_PATH_MODULES . '/' . $module . '/buildmodes';
  menu_rebuild();
  drupal_rebuild_theme_registry();
}