function date_widget_settings_validate in Date 6
Same name and namespace in other branches
- 6.2 date/date_admin.inc \date_widget_settings_validate()
 
Custom widget settings manipulation.
CCK widget settings can't use form_set_value(), so do it in a custom function.
1 string reference to 'date_widget_settings_validate'
File
- date/
date_admin.inc, line 46  - Date administration code. Moved to separate file since there is a lot of code here that is not needed often.
 
Code
function date_widget_settings_validate(&$form, &$form_state) {
  $form_values = $form_state['values'];
  // Only a limited set of formats is available for the Date Popup module
  if ($form_values['widget_type'] == 'date_popup') {
    if (!empty($form_values['input_format_custom']) || !in_array($form_values['input_format'], date_popup_formats())) {
      form_set_value($form['input_format_custom'], NULL, $form_state);
      form_set_value($form['input_format'], DATE_FORMAT_DATETIME, $form_state);
    }
  }
  if (isset($form_values['advanced']['label_position'])) {
    form_set_value($form['label_position'], $form_values['advanced']['label_position'], $form_state);
  }
  // Munge the table display for text parts back into an array of text parts.
  if (is_array($form_values['advanced']['text_parts'])) {
    form_set_value($form['text_parts'], array_keys(array_filter($form_values['advanced']['text_parts'])), $form_state);
  }
}