function date_default_formatter_settings_form in Date 7
Same name and namespace in other branches
- 7.3 date_admin.inc \date_default_formatter_settings_form()
- 7.2 date_admin.inc \date_default_formatter_settings_form()
Settings for the default formatter.
1 call to date_default_formatter_settings_form()
- date_field_formatter_settings_form in ./
date.field.inc - Implements hook_field_formatter_settings_form().
File
- ./
date_admin.inc, line 10 - Date administration code. Moved to separate file since there is a lot of code here that is not needed often.
Code
function date_default_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$formatter = $display['type'];
$form = array();
$form['format_type'] = array(
'#title' => t('Format:'),
'#type' => 'select',
'#options' => date_format_type_options(),
'#default_value' => $settings['format_type'],
'#weight' => 0,
);
$form['fromto'] = array(
'#title' => t('Display:'),
'#type' => 'select',
'#options' => array(
'both' => t('Both From and To dates'),
'value' => t('From date only'),
'value2' => t('To 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' => theme('advanced_help_topic', 'date_api', 'date-display') . $prefix,
'#field_suffix' => $suffix,
'#default_value' => $settings['multiple_number'],
'#weight' => 2,
'#access' => $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED ? 1 : $field['cardinality'],
'#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 ? 1 : $field['cardinality'],
);
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 ? 1 : $field['cardinality'],
'#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_repeat_rule'] = array(
'#title' => t('Repeat rule:'),
'#type' => 'select',
'#options' => array(
'show' => t('Display repeat rule'),
'hide' => t('Hide repeat rule'),
),
'#default_value' => $settings['show_repeat_rule'],
'#access' => $field['settings']['repeat'],
'#weight' => 5,
);
return $form;
}