You are here

function theme_date_display_range in Date 7.2

Same name and namespace in other branches
  1. 8 date.theme \theme_date_display_range()
  2. 5.2 date/date.theme \theme_date_display_range()
  3. 6.2 date/date.theme \theme_date_display_range()
  4. 7.3 date.theme \theme_date_display_range()
  5. 7 date.theme \theme_date_display_range()

Returns HTML for a date element formatted as a range.

1 theme call to theme_date_display_range()
theme_date_display_combination in ./date.theme
Returns HTML for a date element formatted as a Start/End combination.

File

./date.theme, line 355
Theme functions.

Code

function theme_date_display_range($variables) {
  $date1 = $variables['date1'];
  $date2 = $variables['date2'];
  $timezone = $variables['timezone'];
  $attributes_start = $variables['attributes_start'];
  $attributes_end = $variables['attributes_end'];
  $show_remaining_days = isset($variables['show_remaining_days']) ? $variables['show_remaining_days'] : '';
  $start_date = '<span class="date-display-start"' . drupal_attributes($attributes_start) . '>' . $date1 . '</span>';
  $end_date = '<span class="date-display-end"' . drupal_attributes($attributes_end) . '>' . $date2 . $timezone . '</span>';

  // If microdata attributes for the start date property have been passed in,
  // add the microdata in meta tags.
  if (!empty($variables['add_microdata'])) {
    $start_date .= '<meta' . drupal_attributes($variables['microdata']['value']['#attributes']) . '/>';
    $end_date .= '<meta' . drupal_attributes($variables['microdata']['value2']['#attributes']) . '/>';
  }

  // Wrap the result with the attributes.
  $output = '<span class="date-display-range">' . t('!start-date to !end-date', array(
    '!start-date' => $start_date,
    '!end-date' => $end_date,
  )) . '</span>';

  // Add remaining message and return.
  return $output . $show_remaining_days;
}