You are here

function expand_birthdays_date in Birthdays 6

Same name and namespace in other branches
  1. 5 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.

1 string reference to 'expand_birthdays_date'
birthdays_form_alter in ./birthdays.module
Implementation of hook_form_alter().

File

./birthdays.module, line 790
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;
}