Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
I can't find this, it seems to be standard, but I probably switched it off lately.
See screenshot.
Comment | File | Size | Author |
---|---|---|---|
calendar.jpg | 23.06 KB | websmash |
Comments
Comment #1
websmash CreditAttribution: websmash commentedNo one?
Comment #2
websmash CreditAttribution: websmash commentedAnyone can help me out?
Comment #3
eusonic CreditAttribution: eusonic commentedI have the same question, and I'm disappointed that this has gone unanswered for 4 months.
To clarify, I need to add the year to the title of a mini calendar block, which normally only shows the month. Is there a simple way to override the default titles for calendar blocks?
Thanks
-Cameron
Comment #4
kfurlotte CreditAttribution: kfurlotte commentedI have the same exact problem right now. I feel like it's something intuitive and easy to do, but for some reason, I can't figure it out.
Comment #5
ThomWilhelm CreditAttribution: ThomWilhelm commentedHave just come across the exact same problem as eusonic mentioned, when viewing by month with the mini calendar it makes sense to show the year as once you toggle between December/January, it makes sense to make clear to the end user which year they are now viewing. Am having a look around to see if there's an easy way to do this, if anyone finds a way then please let us know.
Thom.
UPDATE: I ended up using https://drupal.org/project/pretty_calendar as it did this out of the box.
Comment #6
aidoskz CreditAttribution: aidoskz commentedtry to insert this into template.php
function yourthemename_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 Y');
$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) ? 'l, F j Y' : 'l, F j');
$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;
}
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;
}
}
Comment #7
whmedia CreditAttribution: whmedia commented#6 works perfectly thanks!!!
Comment #8
thalemn CreditAttribution: thalemn commentedThank you for posting the template.php code. Worked perfectly.
Comment #9
alexaffonso CreditAttribution: alexaffonso commented#6 works well, but...
I can't figure out how to place the month and year within different divs/ tags. I'd like to be able to format the month and year as two different elements, but the #6 solution inserts the year inside the same h3 and a tags of the month. Do someone know how to achieve that? I tried the date-views-pager.tpl.php with no success.
Right now I'm with the following results:
And I'd like to have something like this:
I do appreciate any help.
Comment #10
kamida CreditAttribution: kamida commented@alexaffonso
One way of doing it would be to remove #6 from your template.tpl.php file (the whole function) and put this instead:
This gives you access to the year and granularity in date-views-pager.tpl.php.
To have it output your desired markup for month mini-calendars, you would then edit it as follows:
becomes:
Comment #11
alexaffonso CreditAttribution: alexaffonso commented#10 worked like a charm.
Thank you so much @kamida. I wouldn't come up with such solution. I do need to dive deep into PHP.
Comment #12
kamida CreditAttribution: kamida commented@alexaffonso
Some php skills, however small, do help tons. Especially when tracking down which file/function/variable does what can be such a pain. Glad I could be of help :)
Comment #13
Funksmaname CreditAttribution: Funksmaname commentedI really need to do this in d6... any ideas?
The 'date-views-pager.tpl.php' is 'date-navigation.tpl.php' in Drupal 6. I tried the above, also tried chanigng the function to yourtheme_preprocess_date_navigation but that didn't work...
Any help much appreciated!
Comment #14
Funksmaname CreditAttribution: Funksmaname commentedFor anyone interested - the correct preprocess function for drupal 6 is:
Comment #15
heshanlkWhat you need to do is this:
Comment #16
metakel CreditAttribution: metakel commentedJust add the code below to the template.php of your theme. Create a new one with
at the beginning if it does not exist yet. Replace nameofyourthem with the actual theme name and clear theme-registry:
Comment #17
BartNijs CreditAttribution: BartNijs commentedThe code in #16 works nicely. Clean and simple.
Comment #18
roball CreditAttribution: roball commentedSolution #16 also worked perfectly for me. Here is a slightly simplified code:
Comment #19
roball CreditAttribution: roball commentedComment #21
AswathyAjish CreditAttribution: AswathyAjish commented#6 worked for me. Thanks for the patch.