function calendar_views_pre_view in Calendar 5
Same name and namespace in other branches
- 5.2 calendar.module \calendar_views_pre_view()
- 6.2 includes/calendar.views.inc \calendar_views_pre_view()
- 7 includes/calendar.views.inc \calendar_views_pre_view()
- 7.2 includes/calendar.views.inc \calendar_views_pre_view()
Implementation of hook_views_pre_view()
File
- ./
calendar.module, line 912 - Adds calendar filtering and displays to Views.
Code
function calendar_views_pre_view(&$view, &$items) {
// If no part of this view has calendar elements, exit.
if (!calendar_is_calendar($view) || !calendar_has_calendar_args($view)) {
return;
}
// Construct a formatted title for the view from the last calendar argument encountered.
switch ($view->calendar_type) {
case 'year':
$view->subtitle = theme('calendar_nav_title', 'YEAR', $view);
break;
case 'month':
$view->subtitle = theme('calendar_nav_title', 'MONTH', $view);
break;
case 'day':
$view->subtitle = theme('calendar_nav_title', 'DAY', $view);
break;
case 'week':
$view->subtitle = theme('calendar_nav_title', 'WEEK', $view);
break;
}
// If this is a view with calendar arguments but not a calendar view,
// add navigation to the top of the view and return.
if (!calendar_is_calendar($view) && calendar_has_calendar_args($view)) {
return theme('calendar_show_nav', $view, $view->build_type == 'block', calendar_is_calendar($view));
}
// If this is a calendar plugin theme view, make sure empty results
// will produce blank calendar page
if (array_key_exists($view->page_type, calendar_view_types())) {
if (!$items && $view->build_type == 'page' && $view->year) {
$view->page_empty = check_markup($view->page_header, $view->page_header_format) . check_markup($view->page_empty, $view->page_empty_format) . theme('calendar_display', $view, array(), 'page') . check_markup($view->page_footer, $view->page_footer_format);
$view->page_empty_format = 3;
}
}
if (array_key_exists($view->block_type, calendar_view_types())) {
if (!$items && $view->build_type == 'block' && $view->year) {
$view->block_empty = check_markup($view->block_header, $view->block_header_format) . check_markup($view->block_empty, $view->block_empty_format) . theme('calendar_display', $view, array(), 'block') . check_markup($view->block_footer, $view->block_footer_format);
$view->block_empty_format = 3;
}
}
}