You are here

function theme_date_calendar_day in Date 8

Same name and namespace in other branches
  1. 6.2 theme/theme.inc \theme_date_calendar_day()
  2. 7.3 date_api/theme/theme.inc \theme_date_calendar_day()
  3. 7 date_api/theme/theme.inc \theme_date_calendar_day()
  4. 7.2 date_api/theme/theme.inc \theme_date_calendar_day()

Returns HTML for a date block that looks like a mini calendar day.

Pass in a date object already set to the right timezone, format as a calendar page date. The calendar styling is created in CSS.

File

date_api/theme/theme.inc, line 59
Theme files for Date API.

Code

function theme_date_calendar_day($variables) {
  $output = '';
  $date = $variables['date'];
  if (!empty($date)) {
    $output .= '<div class="date-calendar-day">';
    $output .= '<span class="month">' . $date
      ->format('M') . '</span>';
    $output .= '<span class="day">' . $date
      ->format('j') . '</span>';
    $output .= '<span class="year">' . $date
      ->format('Y') . '</span>';
    $output .= '</div>';
  }
  return $output;
}