Drupal Calendar 0000 glitch

If you use the Drupal calendar module and wonder why the navigation links always link to the year 0000, there is a simple fix. Open up the file sites/all/modules/calender/theme/theme.inc and after this stanza (lines 19-23):

// Create the links to other displays.
$now = date_now();
$url = $view->get_url();
$view->date_info->url = $url;
$arg = $view->date_info->date_arg;

add the following line:

$view->date_info->year = $view->date_info->year && $view->date_info->year != $view->argument['date_argument']->options['wildcard'] ? $view->date_info->year : date_format($now, 'Y');

Posted on July 22, 2010 at 6:02 pm by mcmlxxii · Permalink
In: Drupal · Tagged with: , , , , , ,

3 Responses

Subscribe to comments via RSS

  1. Written by Varun
    on 04/08/2011 at 7:49 pm
    Permalink

    Hi mcmlxxii,

    Thanks for that. Could you kindly tell me what change I should make in the D7 version (7.2 alpha) calendar to ensure that the glitch does not happen?

    Thanks!

    Varun

  2. Written by Varun
    on 04/08/2011 at 8:18 pm
    Permalink

    Thanks – I got it! Not very different. Only that $now should be changed to $current_date and should be placed at a later point, before the check for other variables

  3. Written by mcmlxxii
    on 13/03/2012 at 3:53 pm
    Permalink

    Thanks Varun, I didn’t realise the problem continued into D7!

Subscribe to comments via RSS

Leave a Reply