function hook_date_combo_process_alter in Date 7.3
Same name and namespace in other branches
- 8 date.api.php \hook_date_combo_process_alter()
- 7.2 date.api.php \hook_date_combo_process_alter()
Alter the date_combo element after the Date module is finished with it.
Parameters
array $element: The $element array.
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.
- form: Nested array of form elements that comprise the form.
2 functions implement hook_date_combo_process_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- date_all_day_date_combo_process_alter in date_all_day/
date_all_day.module - Implements hook_date_combo_process_alter().
- date_repeat_field_date_combo_process_alter in date_repeat_field/
date_repeat_field.module - Implements hook_date_combo_process_alter().
1 invocation of hook_date_combo_process_alter()
- date_combo_element_process in ./
date_elements.inc - Process an individual date element.
File
- ./
date.api.php, line 328 - Hooks provided by the Date module.
Code
function hook_date_combo_process_alter(array &$element, array &$form_state, array $context) {
$field = $context['field'];
$instance = $context['instance'];
$field_name = $element['#field_name'];
$delta = $element['#delta'];
// Add a date repeat form element, if needed.
// We delayed until this point so we don't bother adding it to hidden fields.
if (date_is_repeat_field($field, $instance)) {
$item = $element['#value'];
$element['rrule'] = array(
'#type' => 'date_repeat_rrule',
'#theme_wrappers' => array(
'date_repeat_rrule',
),
'#default_value' => isset($item['rrule']) ? $item['rrule'] : '',
'#date_timezone' => $element['#date_timezone'],
'#date_format' => date_limit_format(date_input_format($element, $field, $instance), $field['settings']['granularity']),
'#date_text_parts' => (array) $instance['widget']['settings']['text_parts'],
'#date_increment' => $instance['widget']['settings']['increment'],
'#date_year_range' => $instance['widget']['settings']['year_range'],
'#date_label_position' => $instance['widget']['settings']['label_position'],
'#date_repeat_widget' => str_replace('_repeat', '', $instance['widget']['type']),
'#date_repeat_collapsed' => $instance['widget']['settings']['repeat_collapsed'],
'#date_flexible' => 0,
'#weight' => $instance['widget']['weight'] + 0.4,
);
}
}