You are here

function _regcode_date_optional in Registration codes 7

Same name and namespace in other branches
  1. 6.2 regcode.admin.php \_regcode_date_optional()
  2. 7.2 regcode.admin.inc \_regcode_date_optional()

Make a date field optional.

1 string reference to '_regcode_date_optional'
regcode_admin_create in ./regcode.admin.php
Create registration codes form.

File

./regcode.admin.php, line 295
Functions and pages needed for the admin UI of regcode module.

Code

function _regcode_date_optional($element, &$form_state) {

  // This is the max we can go with 32 bit integers unless we go for larger data
  // types.
  $element['year']['#options'] = drupal_map_assoc(range(1972, 2030));
  foreach (array(
    'year',
    'month',
    'day',
  ) as $field) {
    $element[$field]['#options'][0] = '--';
    ksort($element[$field]['#options']);
  }
  return $element;
}