1 date.api.php | hook_date_field_formatter_settings_form_alter(&$form, &$form_state, $context) |
Alter a date field formatter settings form.
Parameters
array $form: Nested array of form elements that comprise the form.
array $form_state: A keyed array containing the current state of the form.
array $context: An associative array containing the following keys:
- field: The $field array.
- instance: The $instance array.
- view_mode: The formatter display mode.
See also
hook_field_formatter_settings_form()
File
- core/
modules/ date/ date.api.php, line 462 - Hooks provided by the Date module.
Code
function hook_date_field_formatter_settings_form_alter(&$form, &$form_state, $context) {
$field = $context['field'];
$instance = $context['instance'];
$view_mode = $context['view_mode'];
$display = $instance['display'][$view_mode];
$formatter = $display['type'];
if ($formatter == 'date_default') {
$form['show_repeat_rule'] = array(
'#title' => t('Repeat rule:'),
'#type' => 'select',
'#options' => array(
'show' => t('Show repeat rule'),
'hide' => t('Hide repeat rule')),
'#default_value' => $field['settings']['show_repeat_rule'],
'#access' => $field['settings']['repeat'],
'#weight' => 5,
);
}
}