function date_all_day_date_field_widget_settings_form_alter in Date 7.3
Same name and namespace in other branches
- 8 date_all_day/date_all_day.module \date_all_day_date_field_widget_settings_form_alter()
- 7.2 date_all_day/date_all_day.module \date_all_day_date_field_widget_settings_form_alter()
Implements hook_date_field_widget_settings_form_alter().
File
- date_all_day/
date_all_day.module, line 371 - Adds All Day functionality to the Date field.
Code
function date_all_day_date_field_widget_settings_form_alter(&$form, $context) {
// This hook lets us alter the field settings form by adding a place to set
// the value added above.
$field = $context['field'];
$instance = $context['instance'];
$settings = $instance['widget']['settings'];
$form['display_all_day'] = array(
'#type' => 'checkbox',
'#title' => t('Display all day checkbox'),
'#default_value' => $settings['display_all_day'],
'#description' => t("Determines whether to display the 'All Day' checkbox to the user."),
'#weight' => 8,
'#fieldset' => 'date_format',
);
// Hide the option to use the all day checkbox for dates with no time.
if (!date_has_time($field['settings']['granularity'])) {
$form['display_all_day']['#type'] = 'hidden';
$form['display_all_day']['#value'] = 0;
}
}