Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In my year view, the month links go to .../year/yyyy-mm
instead of .../month/yyyy-mm
. For example, clicking on January in the year view will go to calendar/year/2014-01
, but I want to it go to calendar/month/2014-01
.
A frequent user claims this used to work properly, but doesn't any more. I don't remember.
I should note that I currently only display the month and year menu tabs. I recently removed the day and week menu tabs,. I tried restoring them but this didn't fix the problem. I don't think this has anything to do with the problem, but it is a change from the default.
Comment | File | Size | Author |
---|
Comments
Comment #1
dhalbert CreditAttribution: dhalbert commentedComment #2
dhalbert CreditAttribution: dhalbert commentedComment #3
jelo CreditAttribution: jelo commentedHmh, my months view works, but I have the same issue with days. In the year view, if a user clicks on nay particular day it goes to /calendar/day/year/2014-11-13 instead of /calendar/day/2014-11-13
Comment #4
dhalbert CreditAttribution: dhalbert commentedI have figured this out after considerable tracing via print statements.
The fix is to make sure that each page display in your Calendar view is set to Format: Calendar for that particular display. Do not rely on the global setting. You should see Format: Calendar in italics. If you see Format: Calendar without italics, click on it, choose the Calendar type, and set it to "This page (override)".
In my case, the Month page display was relying on the default Format.
Technical details: I narrowed down the problem to
calendar_granularity_path()
incalendar.module
. If it does not finddisplay_options['style_plugin']
value (which will be true if the display does not have its own override), it does not try to look up adisplay_options['path']
value, and does not return the propercalendar_granularity_path
, which is used to setpath_override
in the view.Comment #5
dhalbert CreditAttribution: dhalbert commentedComment #6
jelo CreditAttribution: jelo commentedThanks for investigating. At least for my case with the year display, this did not solve the problem. Unless you are saying I need to remove all other displays as well that do not use Calendar format? I added a number of other displays in the view to provide a listing of events, but they all have different formats than calendar.
Comment #8
dhalbert CreditAttribution: dhalbert commented@jelo: It's just important that that particular display has its own settings instead of using the default settings (if it has its own settings, it will be in italics.) You don't need to remove the other displays, but you need to force this one to not share settings with the other displays.
This is really a bug, I believe, and I will reopen it as such.
Comment #9
dhalbert CreditAttribution: dhalbert commentedComment #10
jelo CreditAttribution: jelo commentedJust to confirm that my year display has its own settings (in italics) and it still doesn't work properly...
Comment #11
cherner CreditAttribution: cherner commentedAny progress on this issue?
Comment #12
dcamburn CreditAttribution: dcamburn commentedThis is still an issue. In a years view the path to the day still goes to /day/year/YYYY-MM-DD
Any fix in store yet?
Comment #13
dcamburn CreditAttribution: dcamburn commentedSo I've found where the year into the day/year issue is happening:
It's in the theme.inc in the function template_preprocess_calendar_datebox
I put in a temporary fix on my site (would love someone to actually fix it) by adding this line:
$vars['url'] = str_replace('/day/year', '/day', $vars['url']);
Right after:
$vars['url'] = str_replace(array($month_path, $year_path), $day_path, date_pager_url($view, NULL, $date, $force_view_url));
It looks like that line is trying to do what my line does anyways so I figured it probably wouldn't break much :P.
Comment #14
salvisThis is still an issue today!
#10ff hijacked the thread to talk about the day links; this seems to be fixed in the meantime.
However, the OP is about the month links: Clicking on a month name in the year view goes to year/yyyy-mm instead of month/yyyy-mm.
A concrete example: If I look at year/2019 (BTW, why is the title "December 2019"?) and I click on "March", then I go to year/2019-03 and this looks like the following:
What I would like to see, obviously, is month/2019-03, which looks like this:
Comment #15
salvisComment #16
snowmountain CreditAttribution: snowmountain commentedI can confirm this issue, with Calendar 7.x-3.5, Drupal 7.64. In the year view page, the month links included "year" in the url. And I saw the same thing as salvis in post #14.
Also the fix mentioned previously, changing my month format to not use the global setting in views, fixed it.
Comment #17
Neslee Canil Pinto