function date_widget_settings_validate in Date 6.2
Same name and namespace in other branches
- 6 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) {
// TODO Not sure there is any limitation any more in this version. Need to check.
if ($form_state['values']['widget_type'] == 'date_popup') {
// Only a limited set of formats is available for the Date Popup module
if (!empty($form_state['values']['input_format_custom']) || !in_array($form_state['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_state['values']['advanced']['label_position'])) {
form_set_value($form['label_position'], $form_state['values']['advanced']['label_position'], $form_state);
}
// Munge the table display for text parts back into an array of text parts.
if (is_array($form_state['values']['advanced']['text_parts'])) {
form_set_value($form['text_parts'], array_keys(array_filter($form_state['values']['advanced']['text_parts'])), $form_state);
}
}