Hello, I would like to request a review of possibly adding the following code to the template.php of this theme.
The issue is that when view the calendar in "month" view it looks like this no matter what day of the month it is. It should just say the MONTH YEAR.
/**
* Theme the calendar title
*/
function responsive_bartik_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;
$format_with_year = variable_get('date_views_' . $granularity . '_format_with_year', 'l, F j, Y');
$format_without_year = variable_get('date_views_' . $granularity . '_format_without_year', 'l, F j');
switch ($granularity) {
case 'year':
$title = $date_info->year;
$date_arg = $date_info->year;
break;
case 'month':
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year);
$title = date_format_date($date_info->min_date, 'custom', $format);
$date_arg = $date_info->year . '-' . date_pad($date_info->month);
break;
case 'day':
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year);
$title = date_format_date($date_info->min_date, 'custom', $format);
$date_arg = $date_info->year . '-' . date_pad($date_info->month) . '-' . date_pad($date_info->day);
break;
case 'week':
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year);
$title = t('Week of @date', array('@date' => date_format_date($date_info->min_date, 'custom', $format)));
$date_arg = $date_info->year . '-W' . date_pad($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;
}
}
After adding the code, navigate to admin/config/regional/date-time/date-views and "Save Configuration"
Clear all caches and the result is the following:
The Date and Calendar module are so common and that non tech users like me will be very frustrated as to how to fix the issue.
I found the original fix here: https://www.drupal.org/node/671068
Comment | File | Size | Author |
---|---|---|---|
Selection_364.png | 22.81 KB | joaomachado | |
Selection_363.png | 23.15 KB | joaomachado |
Comments
Comment #2
abarpetia CreditAttribution: abarpetia as a volunteer commentedAre you still having this issue? I checked calendar and for me, Month view only displaying month and year.
Comment #3
abarpetia CreditAttribution: abarpetia as a volunteer commented