function regcode_format_dates in Registration codes 7.2
[regcode_format_dates description].
Parameters
[type] $form_element: [description].
[type] $form_state: [description].
Return value
[type] [description]
1 string reference to 'regcode_format_dates'
- regcode_admin_create in ./
regcode.admin.inc - Create registration codes form.
File
- ./
regcode.admin.inc, line 249 - Functions and pages needed for the admin UI of regcode module.
Code
function regcode_format_dates($form_element, &$form_state) {
// We unset the current values.
unset($form_element['year']['#options']);
// Now we set the range we want.
// 100 years ago.
$max_age = date('Y') + 15;
// 7 years ago.
$min_age = date('Y') - 15;
// Now we populate the array.
$form_element['year']['#options'] = array();
foreach (range($max_age, $min_age) as $year) {
$form_element['year']['#options'][$year] = $year;
}
// We return our modified element.
return $form_element;
}