You are here

function ds_extras_vd_bundle_remove_submit in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_extras/includes/ds_extras.vd.inc \ds_extras_vd_bundle_remove_submit()

Submit callback: remove a views bundle

File

modules/ds_extras/ds_extras.vd.inc, line 249
Views displays functions.

Code

function ds_extras_vd_bundle_remove_submit($form, &$form_state) {
  $bundle = $form['#bundle'];
  $label = $form['#label'];

  // Remove bundle.
  db_delete('ds_vd')
    ->condition('vd', $bundle)
    ->execute();

  // Remove layout.
  db_delete('ds_layout_settings')
    ->condition('bundle', $bundle)
    ->execute();

  // Remove settings.
  db_delete('ds_field_settings')
    ->condition('bundle', $bundle)
    ->execute();

  // Remove from bundle settings.
  variable_del('field_bundle_settings_ds_views__' . $bundle);

  // Clear entity cache and field info fields cache.
  cache_clear_all('field_info_fields', 'cache_field');
  cache_clear_all('entity_info', 'cache', TRUE);
  drupal_set_message(t('Bundle @label has been removed.', array(
    '@label' => $label,
  )));
}