You are here

function template_preprocess_birthdays_page in Birthdays 6

Preprocess variables to format the birthdays page.

$variables contains the following data:

  • $accounts
  • $filter_month
  • $filter_year

File

./birthdays.page.inc, line 118
All functions related to the birthdays listings page

Code

function template_preprocess_birthdays_page(&$variables) {
  global $_birthdays_field;
  $row = 0;
  $birthdays = array();
  $variables['show_year'] = variable_get('birthdays_hide_year', BIRTHDAYS_HIDE_YEAR_NO) != BIRTHDAYS_HIDE_YEAR_YES;
  $variables['show_starsign'] = (bool) variable_get('birthdays_show_starsign', BIRTHDAYS_STARSIGN_OFF);
  $variables['show_user_picture'] = variable_get('user_pictures', FALSE);
  $variables['show_filter'] = variable_get('birthdays_page_show_filters', 1);
  foreach ($variables['accounts'] as $account) {
    $birthdays[$row] = array(
      'account' => $account,
      'age' => _birthdays_show_age($account),
      'username' => theme('username', $account),
      'starsign' => birthdays_get_starsign_image($account->birthdays_starsign, variable_get('birthdays_show_starsign', BIRTHDAYS_STARSIGN_OFF)),
      'picture' => theme('user_picture', $account),
      'date' => _birthdays_show_date($account->{$_birthdays_field->name}, $account),
      'zebra' => $row % 2 == 0 ? 'odd' : 'even',
    );
    $birthdays[$row]['show_age'] = isset($birthdays[$row]['age']);
    $row++;
  }
  $variables['birthdays'] = $birthdays;
  $variables['filter_form'] = drupal_get_form('birthdays_page_filter', $variables['filter_month'], $variables['filter_year']);
  $variables['pager'] = theme('pager', NULL, variable_get('birthdays_page_list_number', 25), 0);
}