You are here

function date_form_alter in Date 7

Same name and namespace in other branches
  1. 5.2 date/date.module \date_form_alter()
  2. 5 date.module \date_form_alter()
  3. 6.2 date/date.module \date_form_alter()
  4. 6 date/date.module \date_form_alter()

Implements hook_form_alter(). Make sure date information gets updated.

File

./date.module, line 407

Code

function date_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'field_ui_field_edit_form') {
    $field = $form['field'];
    $instance = $form['instance'];

    // If adding a repeat, override the Content module's handling of the multiple values option.
    if (module_exists('date_repeat') && date_is_repeat_field($field, $instance)) {
      $form['field']['cardinality'] = array(
        '#type' => 'hidden',
        '#value' => FIELD_CARDINALITY_UNLIMITED,
      );
    }
  }
}