1 date.admin.inc | date_default_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) |
Settings for the default formatter.
File
- core/
modules/ date/ date.admin.inc, line 10 - Admin page callbacks for the Date module.
Code
function date_default_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$form = array();
$form['format_type'] = array(
'#title' => t('Choose how users view dates and times:'),
'#type' => 'select',
'#options' => date_format_type_options(),
'#default_value' => $settings['format_type'],
'#description' => t('To add or edit options, visit <a href="@date-time-page">Date and time settings</a>.', array('@date-time-page' => url('admin/config/regional/date-time'))),
'#weight' => 0,
);
$form['fromto'] = array(
'#title' => t('Display:'),
'#type' => 'select',
'#options' => array(
'both' => t('Both Start and End dates'),
'value' => t('Start date only'),
'value2' => t('End date only'),
),
'#access' => $field['settings']['todate'],
'#default_value' => $settings['fromto'],
'#weight' => 1,
);
// Make the string translatable by keeping it as a whole rather than
// translating prefix and suffix separately.
list($prefix, $suffix) = explode('@count', t('Show @count value(s)'));
$form['multiple_number'] = array(
'#type' => 'textfield',
'#title' => t('Multiple values:'),
'#size' => 5,
'#field_prefix' => $prefix,
'#field_suffix' => $suffix,
'#default_value' => $settings['multiple_number'],
'#weight' => 2,
'#access' => ($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED) || ($field['cardinality'] > 1),
'#description' => t('Identify a specific number of values to display, or leave blank to show all values.'),
);
list($prefix, $suffix) = explode('@isodate', t('starting from @isodate'));
$form['multiple_from'] = array(
'#type' => 'textfield',
'#size' => 15,
'#field_prefix' => $prefix,
'#field_suffix' => $suffix,
'#default_value' => $settings['multiple_from'],
'#weight' => 3,
'#access' => ($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED) || ($field['cardinality'] > 1),
);
list($prefix, $suffix) = explode('@isodate', t('ending with @isodate'));
$form['multiple_to'] = array(
'#type' => 'textfield',
'#size' => 15,
'#field_prefix' => $prefix,
'#field_suffix' => $suffix,
'#default_value' => $settings['multiple_to'],
'#weight' => 4,
'#access' => ($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED) || ($field['cardinality'] > 1),
'#description' => t('Identify specific start and/or end dates in the format YYYY-MM-DDTHH:MM:SS, or leave blank for all available dates.'),
);
$form['show_remaining_days'] = array(
'#title' => t('Show remaining days'),
'#type' => 'checkbox',
'#default_value' => $settings['show_remaining_days'],
'#weight' => 0,
);
return $form;
}