function theme_date_nav_title in Date 8
Same name and namespace in other branches
- 6.2 theme/theme.inc \theme_date_nav_title()
- 6 theme/theme.inc \theme_date_nav_title()
- 7.3 date_views/theme/theme.inc \theme_date_nav_title()
- 7 date_views/theme/theme.inc \theme_date_nav_title()
- 7.2 date_views/theme/theme.inc \theme_date_nav_title()
Theme the calendar title
1 theme call to theme_date_nav_title()
- template_preprocess_date_views_pager in date_views/
theme/ theme.inc - Preprocess function for Date pager template.
File
- date_views/
theme/ theme.inc, line 166 - Theme files for Date Pager.
Code
function theme_date_nav_title($params) {
$granularity = $params['granularity'];
$view = $params['view'];
$date_info = $view->date_info;
$link = !empty($params['link']) ? $params['link'] : FALSE;
$format = !empty($params['format']) ? $params['format'] : NULL;
switch ($granularity) {
case 'year':
$title = $date_info->year;
$date_arg = $date_info->year;
break;
case 'month':
$format = !empty($format) ? $format : (empty($date_info->mini) ? 'F Y' : 'F');
$title = $date_info->min_date
->format($format);
$date_arg = $date_info->year . '-' . DrupalDateTime::datePad($date_info->month);
break;
case 'day':
$format = !empty($format) ? $format : (empty($date_info->mini) ? 'l, F j, Y' : 'l, F j');
$title = $date_info->min_date
->format($format);
$date_arg = $date_info->year . '-' . DrupalDateTime::datePad($date_info->month) . '-' . DrupalDateTime::datePad($date_info->day);
break;
case 'week':
$format = !empty($format) ? $format : (empty($date_info->mini) ? 'F j, Y' : 'F j');
$title = t('Week of @date', array(
'@date' => $date_info->min_date
->format($format),
));
$date_arg = $date_info->year . '-W' . DrupalDateTime::datePad($date_info->week);
break;
}
if (!empty($date_info->mini) || $link) {
// Month navigation titles are used as links in the mini view.
$attributes = array(
'title' => t('View full page month'),
);
$url = date_pager_url($view, $granularity, $date_arg, TRUE);
return l($title, $url, array(
'attributes' => $attributes,
));
}
else {
return $title;
}
}