function date_formatter_setup_form in Date 6
Same name and namespace in other branches
- 5.2 date/date_admin.inc \date_formatter_setup_form()
- 5 date_admin.inc \date_formatter_setup_form()
A form to create a date formatter option
1 call to date_formatter_setup_form()
File
- date/
date_admin.inc, line 408 - Date administration code. Moved to separate file since there is a lot of code here that is not needed often.
Code
function date_formatter_setup_form($field, $delta) {
switch ($delta) {
case 1:
$name = 'long';
$label = t('Long');
$default = variable_get('date_format_long', 'l, F j, Y - H:i');
break;
case 2:
$name = 'medium';
$label = t('Medium');
$default = variable_get('date_format_medium', 'D, m/d/Y - H:i');
break;
case 3:
$name = 'short';
$label = t('Short');
$default = variable_get('date_format_short', 'm/d/Y - H:i');
break;
default:
$name = 'default';
$label = t('Default');
$default = variable_get('date_format_short', 'm/d/Y - H:i');
}
$append = $delta > 0 ? '_' . $name : '';
$form = array(
'#type' => 'fieldset',
'#title' => $label,
);
$form['output_format_date' . $append] = array(
'#type' => 'select',
'#title' => t('Date display'),
'#default_value' => $field['output_format_date' . $append] ? $field['output_format_date' . $append] : $default,
'#options' => date_format_options(),
'#multiple' => false,
);
$form['output_format_custom' . $append] = array(
'#type' => 'textfield',
'#title' => t('*Custom display format'),
'#default_value' => $field['output_format_custom' . $append] ? $field['output_format_custom' . $append] : '',
);
return $form;
}