function birthdays_page_filter in Birthdays 6
Same name and namespace in other branches
- 5 birthdays.module \birthdays_page_filter()
Return a form containing a select box to filter users by month of birth
Parameters
$filter_month:
int $filter_year:
Return value
array of the form
1 string reference to 'birthdays_page_filter'
- template_preprocess_birthdays_page in ./
birthdays.page.inc - Preprocess variables to format the birthdays page.
File
- ./
birthdays.page.inc, line 73 - All functions related to the birthdays listings page
Code
function birthdays_page_filter($filter_month = NULL, $filter_year = NULL) {
$options_months[0] = '';
for ($i = 1; $i <= 12; $i++) {
$options_months[$i] = format_date(gmmktime(0, 0, 0, $i, 2, 1970), 'custom', 'F', 0);
}
$options_years[0] = '';
$options_years = $options_years + drupal_map_assoc(range(date('Y'), 1900));
$form['birthdays_filter_month'] = array(
'#type' => 'select',
'#options' => $options_months,
'#default_value' => $filter_month,
'#title' => t('Filter by month'),
'#attributes' => array(
'onchange' => 'submit()',
),
);
if (variable_get('birthdays_hide_year', BIRTHDAYS_HIDE_YEAR_NO) != BIRTHDAYS_HIDE_YEAR_YES) {
$form['birthdays_filter_year'] = array(
'#type' => 'select',
'#options' => $options_years,
'#default_value' => $filter_year,
'#title' => t('Year'),
'#attributes' => array(
'onchange' => 'submit()',
),
);
}
$form['button'] = array(
'#type' => 'button',
'#prefix' => '<noscript>',
'#value' => t('Filter'),
'#suffix' => '</noscript>',
);
return $form;
}