You are here

function template_preprocess_calendar_month_multiple_entity in Calendar 8

Same name and namespace in other branches
  1. 7.3 theme/theme.inc \template_preprocess_calendar_month_multiple_entity()

Format an calendar month node for display.

File

./calendar.theme.inc, line 630
Theme functions for the Calendar module.

Code

function template_preprocess_calendar_month_multiple_entity(&$vars) {

  // @todo Fix when multiday events are supported again.
  $view = $vars['view'];
  $curday = $vars['curday'];
  $count = $vars['count'];
  $ids = $vars['ids'];
  $date = $vars['date'];

  // Get the year month and date.
  $parts = explode('-', substr($curday, 0, 10));
  $year = $parts[0];
  $month = intval($parts[1]);
  $day = intval($parts[2]);

  // Create the link to the day.
  $full_date_arg = str_replace('-', '', $date);
  $month_path = CalendarHelper::getURLForGranularity($view, 'month', [
    $full_date_arg,
  ]);
  $day_path = CalendarHelper::getURLForGranularity($view, 'day', [
    $full_date_arg,
  ]);
  $vars['link'] = str_replace($month_path, $day_path, date_pager_url($view, NULL, DateTimePlus::datePad($year, 4) . '-' . DateTimePlus::datePad($month) . '-' . DateTimePlus::datePad($day)));
}