You are here

function ds_field_delete_reset_form_submit in Display Suite 6.3

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

Delete or reset a field.

File

includes/ds.fields.inc, line 721
Manage fields.

Code

function ds_field_delete_reset_form_submit($form, &$form_state) {
  $module = $form['#module'];
  $fields = variable_get($module . '_fields', array());
  $field = $fields[$form_state['values']['field']];
  $field_title = $field['title'];
  $action = $field['status'] == DS_FIELD_STATUS_OVERRIDDEN ? t('reset') : t('deleted');

  // Save and invalidate fields_cached.
  unset($fields[$form_state['values']['field']]);
  variable_set($module . '_fields', $fields);
  ds_reset_fields_cache();
  drupal_set_message(t('Field %field has been !action.', array(
    '%field' => $field_title,
    '!action' => $action,
  )));
  $form_state['redirect'] = DS_PATH_MODULES . '/' . $form['#module'] . '/fields';
}