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.
I would like to use just a year and month views. As suggested in the docs, I've unattached day and week. Its more less ok, but theres few things I would like to change. Day links in month views are still clickable and they lead to an empty page now. Is there a easy way without touching the code to make them unclickable? The other thing is the year view. Is there a way to make day links open month view instead of the day view (which is empty page now)? Eventualy disabling the day links in year view would be nice too.
Comment | File | Size | Author |
---|---|---|---|
#3 | theme.inc_.patch | 626 bytes | marcushenningsen |
Comments
Comment #1
KarenS CreditAttribution: KarenS commentedAll of those things can be done in the theme layer. There are themes available for all the calendar parts. Find the theme that you want to change and override it in the normal Drupal way to behave however you want.
Comment #3
marcushenningsen CreditAttribution: marcushenningsen commentedReopening this issue, since I might have a solution.
In theme.inc (placed in the theme folder of the calendar module) on line 514 is where the link in the date box is generated:
$vars['link'] = l($vars['day'], $vars['url']);
I simply added a check for day views: if the day exists ouput the link, if it doesn't just show the day without the link:
For weeks this already works. E.g. on a month view with week numbers shown, week numbers will only link to the week view if the view view exists. I'm not sure where this piece of code can be found, and therefore I don't really know if my solution is in line with the module code. However, my solution seems to work flawlessly. Would like a confirmation on this, though.
Marcus
Comment #4
doublejosh CreditAttribution: doublejosh commentedWait, you can't remove the links to days in the theme layer.
The theme layer outputs
$cell['data'];
which already has the nodes and day link rendered into HTML.So it's too late at the theme layer.
I'm trying to avoid messing with theme.inc How can I alter this output in the theme layer?
Comment #5
marcushenningsen CreditAttribution: marcushenningsen commentedI don't think you can. As I see it, there's no way around messing with theme.inc. Could you please check if my solution works for you, then we can call on a maintainer to review and perhaps commit the patch?
Marcus
Comment #6
BKWill CreditAttribution: BKWill commentedI've applied your patch and it works just fine. This should be an essential option that is incorporated in the main release. It doesn't make sense to link to a page that doesn't contain data. Thank you for putting in the time to fix this.
Cheers,
Will
Comment #7
marcushenningsen CreditAttribution: marcushenningsen commentedThanks for testing. Changing the status.
Comment #8
Danny_Joris CreditAttribution: Danny_Joris commentedI agree with this issue. I don't want days in my calendar either. I managed to 'unlink' the separate days, but in the menu bar 'days' is still available. I know I could just hide it with css, but I don't like that. I shouldnt be messing with an .inc file.
Has this been committed yet?
-- Edit:
I fixed my issue by adding the following snippet to the calendar-main.tpl.php template.
Just unset the right keys in the links array.
-- Edit2: Hmm weird. It does appear to be enough to 'de-attach' the day and week views to remove week and day links. I must have overlooked that. Anyway, code snippet is not needed then. Sorry to bother :)
Comment #9
Fidelix CreditAttribution: Fidelix commentedSolving this is actually simple.
Create a file named calendar-datebox.tpl.php in your theme directory.
Fill it with this:
There you have it. No hacks.
Comment #10
marcushenningsen CreditAttribution: marcushenningsen commentedThanks for your idea, Fidelex. I tried your solution, but it seems to work as expected only if the days have no events. Can you confirm this?
Marcus
Comment #11
Fidelix CreditAttribution: Fidelix commentedThis is on purpose Marcus.
If the day has events, its common sense to link it to the days page so the user can view the events.
If you want to FULLY remove the links, even if the day have events, here is the code:
Very simple, right?
Good luck!
Comment #12
bryancasler CreditAttribution: bryancasler commented#9 worked but it broke the functionality of this module http://drupal.org/project/calendar_tooltips
It also created some weird css display problems. Once you hovered over a date in the calendar it would continue displaying that date its hovered style permanently.
Comment #13
KarenS CreditAttribution: KarenS commentedCommitted, thanks.
Comment #14
Fidelix CreditAttribution: Fidelix commentedWhat exactly did you commit KarenS?
The patch on the theme layer or the template i created?
Comment #15
KarenS CreditAttribution: KarenS commentedThere is only one patch in this issue. That is what I committed.
Comment #17
ailgm CreditAttribution: ailgm commentedUsing 6.x-2.4, I'm encountering this problem. I've removed year, week and day displays. The day numbers are still linked for days with events in them.
I found similar lines at the end of template_preprocess_calendar_month_multiple_node and template_preprocess_calendar_week_multiple_node routines and added the same check. That made no difference to the one display I'm still using (month).
Is anyone else experiencing this? Have you solved it?
Comment #18
rcastera CreditAttribution: rcastera commented#11 worked beautifully! Exactly what a client requested. Thanks!
Comment #19
Pat Redmond CreditAttribution: Pat Redmond commentedI think this is actually a bug. When I installed the module, I don't get any link from the month view to the day view. When I use the code in #9 I get the link. I'm not really sure why that's the case, but I think that it is worth including that code in the module.
Comment #20
M3lissa CreditAttribution: M3lissa commented#9 works perfect! Thanks a lot, I was really getting crazy about it! Thanks.
Comment #21
bgm CreditAttribution: bgm commentedI can't confirm/test for Drupal 6, but this works fine on Drupal 7: disabling the 'day' view display will disable the links on the calendar day. I think that this issue was accidentally re-opened.