You are here

function ds_field_ui_change_layout_submit in Display Suite 7.2

Same name and namespace in other branches
  1. 8.4 includes/field_ui.inc \ds_field_ui_change_layout_submit()
  2. 8.2 includes/field_ui.inc \ds_field_ui_change_layout_submit()
  3. 8.3 includes/field_ui.inc \ds_field_ui_change_layout_submit()

Form submission handler for _ds_field_ui_table_layouts_preview().

1 string reference to 'ds_field_ui_change_layout_submit'
_ds_field_ui_table_layouts_preview in includes/ds.field_ui.inc
Add the layout previews to the Field UI screen.

File

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

Code

function ds_field_ui_change_layout_submit($form, &$form_state) {
  $values = $form_state['values'];
  if (isset($values['additional_settings']['preview']['info']['settings']['disable_css'])) {
    $disable_css = $values['additional_settings']['preview']['info']['settings']['disable_css'];
  }
  else {
    $disable_css = FALSE;
  }
  $record = db_select('ds_layout_settings')
    ->fields('ds_layout_settings')
    ->condition('entity_type', $values['ds_entity_type'])
    ->condition('bundle', $values['ds_bundle'])
    ->condition('view_mode', $values['ds_view_mode'])
    ->execute()
    ->fetchObject();
  $record->settings = unserialize($record->settings);
  $record->settings['layout_disable_css'] = $disable_css;
  drupal_write_record('ds_layout_settings', $record, array(
    'id',
  ));
  unset($_GET['destination']);
  global $base_url;
  $url = $base_url . '/' . $values['layout_changed_url'];
  $form_state['redirect'] = $url;
}