1.20.x date.api.php hook_date_combo_process_alter(&$element, &$form_state, $context)

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.

File

modules/date/date.api.php, line 324
Hooks provided by the Date module.

Code

function hook_date_combo_process_alter(&$element, &$form_state, $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 ($instance['settings']['extend']) {
    $element['another_element'] = array(
      '#type' => 'checkbox',
      '#title' => t('New option on the date field'),
    );
  }
}