You are here

function ds_preprocess_field_form_submit in Display Suite 6

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

Save preprocess field.

1 string reference to 'ds_preprocess_field_form_submit'
ds_preprocess_field_form in includes/ds.fields.inc
Preprocess field form.

File

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

Code

function ds_preprocess_field_form_submit($form, &$form_state) {
  $module = $form['#module'];
  $fields = variable_get($module . '_fields', array());
  $key = $form_state['values']['preprocess_key'];
  $fields[$key] = array(
    'title' => $form_state['values']['preprocess_title'],
    'exclude' => $form_state['values']['preprocess_exclude'],
    'type' => DS_FIELD_TYPE_PREPROCESS,
    'status' => $form['#field_status'],
    'properties' => array(
      'key' => $form_state['values']['preprocess_array_key'],
    ),
  );

  // Code class.
  if (!empty($form_state['values']['preprocess_class'])) {
    $fields[$key]['properties']['css-class'] = $form_state['values']['preprocess_class'];
  }

  // Safe field and invalidate cached fields.
  variable_set($module . '_fields', $fields);
  variable_del('ds_fields_cached');

  // Redirect and confirmation message.
  $form_state['redirect'] = 'admin/build/ds/' . $form['#module'] . '/fields';
  drupal_set_message(t('Field %field has been saved.', array(
    '%field' => $form_state['values']['preprocess_title'],
  )));
}