You are here

function ds_revert_layout_field_settings_form_submit in Display Suite 7.2

Same name and namespace in other branches
  1. 7 ds.field_ui.inc \ds_revert_layout_field_settings_form_submit()

Submit callback: revert layout and field settings.

File

includes/ds.field_ui.inc, line 239
Field UI functions for Display Suite.

Code

function ds_revert_layout_field_settings_form_submit(&$form, &$form_state) {
  $layout = $form['#layout'];
  db_delete('ds_field_settings')
    ->condition('id', $layout->id)
    ->execute();
  db_delete('ds_layout_settings')
    ->condition('id', $layout->id)
    ->execute();

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

  // Clear entity info cache.
  cache_clear_all('entity_info', 'cache', TRUE);
  drupal_set_message(t('Layout has been reverted'));
  $form_state['redirect'] = isset($_GET['destination']) ? $_GET['destination'] : drupal_get_destination();
}