You are here

function ds_remove_field_confirm_submit in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_ui/includes/ds.fields.inc \ds_remove_field_confirm_submit()

Confirmed field delete or revert submit callback.

2 calls to ds_remove_field_confirm_submit()
ds_delete_field_confirm_submit in ./ds.fields.inc
Submit callback: confirmed delete submit.
ds_revert_field_confirm_submit in ./ds.fields.inc
Submit callback: confirmed revert submit.

File

./ds.fields.inc, line 440
Administrative functions for managing custom fields for every entity.

Code

function ds_remove_field_confirm_submit($form, &$form_state, $action = 'deleted') {
  $field = $form['#ds_field'];

  // Remove field.
  db_delete('ds_fields')
    ->condition('field', $field->field)
    ->execute();

  // Clear cache.
  cache_clear_all('ds_fields:', 'cache', TRUE);

  // Redirect.
  $form_state['redirect'] = 'admin/structure/ds/fields';
  drupal_set_message(t('The field %field has been ' . $action, array(
    '%field' => $field->label,
  )));
}