function expand_birthdays_date in Birthdays 5
Same name and namespace in other branches
- 6 birthdays.module \expand_birthdays_date()
Process the birthday field (based on a regular date element) to limit it to past birthdays and make it the entire element optional by adding empty options for days, months and years.
File
- ./
birthdays.module, line 1155 - The Birthdays module allows users to add their birthday to their profile. It lists birthdays on a seperate page and in different blocks. Users can receive an e-mail on their birthday automatically, and the administrator can receive daily reminders of…
Code
function expand_birthdays_date($element) {
if (empty($element['#value'])) {
$element['#value'] = array(
'day' => '',
'month' => '',
'year' => '',
);
}
$element = expand_date($element);
$element['month']['#options'] = array(
'' => '--',
) + $element['month']['#options'];
$element['day']['#options'] = array(
'' => '--',
) + $element['day']['#options'];
$element['year']['#options'] = array(
'' => '--',
) + drupal_map_assoc(range(date('Y'), 1900));
return $element;
}