function template_preprocess_calendar_month in Calendar 7
Same name in this branch
- 7 theme/theme.inc \template_preprocess_calendar_month()
- 7 calendar_multiday/theme/theme.inc \template_preprocess_calendar_month()
Same name and namespace in other branches
- 8 calendar.theme.inc \template_preprocess_calendar_month()
- 6.2 theme/theme.inc \template_preprocess_calendar_month()
- 6.2 calendar_multiday/theme/theme.inc \template_preprocess_calendar_month()
- 7.3 theme/theme.inc \template_preprocess_calendar_month()
- 7.2 theme/theme.inc \template_preprocess_calendar_month()
- 7.2 calendar_multiday/theme/theme.inc \template_preprocess_calendar_month()
Display a month view.
2 calls to template_preprocess_calendar_month()
- template_preprocess_calendar_mini in theme/
theme.inc - Display a mini month view.
- template_preprocess_calendar_mini in calendar_multiday/
theme/ theme.inc - Display a mini month view.
File
- theme/
theme.inc, line 206 - Theme functions for the Calendar module.
Code
function template_preprocess_calendar_month(&$vars) {
// Add in all the $vars added by the main calendar preprocessor.
template_preprocess_calendar($vars);
$view = $vars['view'];
$rows = $vars['rows'];
if (empty($rows)) {
$rows = array();
$day_names = array();
}
elseif (sizeof($rows) > 1) {
$day_names = array_shift($rows);
}
else {
$day_names = $rows;
$rows = array();
}
$month_rows = $rows;
foreach ($rows as $weekno => $row) {
foreach ($row as $day => $data) {
$cell = $data['data'];
// If this cell is already rendered, like the weekno column,
// move to the next item.
if (!is_array($cell)) {
$month_rows[$weekno][$day]['data'] = $cell;
continue;
}
$data = $cell['datebox'];
if ($cell['empty']) {
$data .= $cell['empty'];
}
else {
$data .= implode($cell['all_day']);
foreach ($cell['items'] as $hour => $item) {
$data .= implode($item);
}
$data .= $cell['link'];
}
if ($view->date_info->mini) {
$month_rows[$weekno][$day]['data'] = $data;
}
else {
$month_rows[$weekno][$day]['data'] = '<div class="inner">' . $data . '</div>';
}
}
}
$vars['rows'] = $month_rows;
$vars['day_names'] = $day_names;
$vars['display_type'] = $view->date_info->granularity;
$vars['min_date_formatted'] = date_format($view->date_info->min_date, DATE_FORMAT_DATETIME);
$vars['max_date_formatted'] = date_format($view->date_info->max_date, DATE_FORMAT_DATETIME);
}