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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dhalbert’s picture

Issue summary: View changes
dhalbert’s picture

Issue summary: View changes
jelo’s picture

Hmh, 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

dhalbert’s picture

I 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() in calendar.module. If it does not find display_options['style_plugin'] value (which will be true if the display does not have its own override), it does not try to look up a display_options['path'] value, and does not return the proper calendar_granularity_path, which is used to set path_override in the view.

dhalbert’s picture

Status: Active » Fixed
jelo’s picture

Thanks 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

dhalbert’s picture

@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.

dhalbert’s picture

Category: Support request » Bug report
Status: Closed (fixed) » Active
jelo’s picture

Just to confirm that my year display has its own settings (in italics) and it still doesn't work properly...

cherner’s picture

Any progress on this issue?

dcamburn’s picture

This 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?

dcamburn’s picture

So 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.

salvis’s picture

This 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:

March in year view

What I would like to see, obviously, is month/2019-03, which looks like this:

March in month view

salvis’s picture

snowmountain’s picture

I 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.

Neslee Canil Pinto’s picture

Status: Active » Closed (outdated)