You are here

function ds_extras_vd_bundle_form_submit in Display Suite 7.2

Same name and namespace in other branches
  1. 7 modules/ds_extras/ds_extras.vd.inc \ds_extras_vd_bundle_form_submit()

Submit callback: save the new bundle.

File

modules/ds_extras/includes/ds_extras.vd.inc, line 110
Views displays functions.

Code

function ds_extras_vd_bundle_form_submit($form, &$form_state) {

  // Save new bundle.
  $record = new stdClass();
  $record->vd = $form_state['values']['vd'];
  $record->label = $form['vd']['#options'][$record->vd];
  drupal_write_record('ds_vd', $record);

  // Clear entity cache and field info fields cache.
  cache_clear_all('field_info_fields', 'cache_field');
  cache_clear_all('entity_info', 'cache', TRUE);

  // Message and redirect.
  drupal_set_message(t('Bundle @label has been added.', array(
    '@label' => $record->label,
  )));
  $form_state['redirect'] = 'admin/structure/ds/vd';
}