1.20.x options.module options_field_instance_settings_validate($form, &$form_state)

Form #validate callback for field_ui_field_edit_form().

File

modules/field/modules/options/options.module, line 600
Defines selection, check box and radio button widgets for text and numeric fields.

Code

function options_field_instance_settings_validate($form, &$form_state) {
  $field = $form['#field'];

  if (!form_get_errors()) {
    // Set default values.
    $default_field_value_key = $form['instance']['default_value_widget'][$field['field_name']][LANGUAGE_NONE]['#value_key'];
    // Create transposed array for field storage.
    $default_values = options_array_transpose(array($default_field_value_key => (array) $form['field']['settings']['allowed_values']['#value']['default_value']));

    form_set_value(
    $form['instance']['default_value_widget'][$field['field_name']][LANGUAGE_NONE], 
    $default_values, 
    $form_state
    );
  }
}