function template_preprocess_calendar_datebox in Calendar 8
Same name and namespace in other branches
- 6.2 theme/theme.inc \template_preprocess_calendar_datebox()
- 6.2 calendar_multiday/theme/theme.inc \template_preprocess_calendar_datebox()
- 7.3 theme/theme.inc \template_preprocess_calendar_datebox()
- 7 theme/theme.inc \template_preprocess_calendar_datebox()
- 7 calendar_multiday/theme/theme.inc \template_preprocess_calendar_datebox()
- 7.2 theme/theme.inc \template_preprocess_calendar_datebox()
- 7.2 calendar_multiday/theme/theme.inc \template_preprocess_calendar_datebox()
Create the calendar date box.
File
- ./
calendar.theme.inc, line 591 - Theme functions for the Calendar module.
Code
function template_preprocess_calendar_datebox(&$vars) {
$date = $vars['date'];
$view = $vars['view'];
$vars['day'] = intval(substr($date, 8, 2));
$vars['mini'] = !empty($view->styleInfo
->isMini());
$link_to_day = !empty($view->style_plugin->options["link_to_date"]);
// $force_view_url = !empty($view->dateInfo->block) ? TRUE : FALSE;
$full_date_arg = str_replace('-', '', $date);
$day_url = CalendarHelper::getURLForGranularity($view, 'day', [
$full_date_arg,
]);
// $vars['url'] = str_replace([$month_path, $year_path], $day_path, date_pager_url($view, NULL, $date, $force_view_url));
if ($day_url) {
if (!$link_to_day) {
$vars['link'] = $vars['day'];
}
else {
$vars['link'] = Link::fromTextAndUrl($vars['day'], $day_url)
->toString();
}
}
else {
$vars['link'] = $vars['day'];
}
$vars['granularity'] = $view->dateInfo
->getGranularity();
if ($vars['mini']) {
if (!empty($vars['selected'])) {
$vars['class'] = 'mini-day-on';
}
else {
$vars['class'] = 'mini-day-off';
}
}
else {
$vars['class'] = 'day';
}
}