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.
Hi there,
I have a calendar page with the little ical download link showing at the bottom. I want to change the download link - make a custom (larger) image and add more explanatory text ("add these events to your calendar" or something, maybe with a link to a help page walking users through importing the ical file into outlook).
Which files / functions do I have to override to change this display?
Forgive my newbie-ness - I'm on the steep part of the Drupal curve.
Thanks in advance.
Comments
Comment #1
Exploratus CreditAttribution: Exploratus commentedsubscribe...
Comment #2
scooper CreditAttribution: scooper commentedI added a text link preceding the iCal icon by making changes to my theme's template.php. First I found the function that displays the iCal icon - it's in folder calendar/calendar_ical, module calendar_ical.module .
Here's my code from template.php (substitute your actual theme name for YOURTHEME):
To get this to take effect, clear the cache under Site configuration->Performance.
Comment #3
tripper54 CreditAttribution: tripper54 commentedNice one, thanks Scooper
Comment #4
BrightBoldI'll definitely be using that, scooper. Thanks.
Comment #6
pbfleetwood CreditAttribution: pbfleetwood commentedI changed the image in CSS with the following code, which pads out the link to be large enough to fit the new button (24px x 64px, in the example) as a background.
Notes:
Comment #7
pbfleetwood CreditAttribution: pbfleetwood commentedThis issue should not be closed, but changed to a feature request, as the module should offer the flexibility of specifying the text and or the image for the iCal link.
Comment #8
KarenS CreditAttribution: KarenS commentedI decided to set Date iCal up as a new project. It can be expanded to include a Feeds parser for importing ical items and add some features to make it easier to import/export ical feeds. Plus it could have another maintainer that is someone interested in doing more work on the iCal standard. I will be deprecating the Calendar iCal module in favor of that one.
Moving this issue there.
Comment #9
coredumperror CreditAttribution: coredumperror commentedPlease check out the new Date iCal 7.x-2.x, then comment on this issue if you're still interested in this feature. I can't guarantee that I'll have time to implement it in the immediate future, though.
Comment #10
vlad.pavlovic CreditAttribution: vlad.pavlovic commentedI think this feature is still needed (ie: the ability to override the link). The main reason is that the contextual filter from the calendar is added to the ical feed link. This happens even if no contextual filter is specified in the path (in that case, the month, week or day definition) is appended to the end of the URL.
Comment #11
coredumperror CreditAttribution: coredumperror commentedYou're right, I should definitely fix this. But I'm not certain what exactly to do, or how to do it. Could you explain exactly what Date iCal should be doing, so I can look into ways to fix it?
Comment #12
vlad.pavlovic CreditAttribution: vlad.pavlovic commentedI think all that might be needed is checking if an argument is a part of the path, and if it's not, then just go the path itself with no arguments at all (instead of appending the argument to the end).
Having said all of that, there are two ways to get around it, one would be to check 'Skip default argument for view URL' for the other displays (Month, Week, Year, etc) Context filter. After all, that's what the checkbox was added for anyway. This adds an 'all' to the path, but that's fine, it will still cache nicely.
And the other is the approach from #2, but using the updated override, which would be 'date_ical_icon', instead of 'calendar_ical_icon' (I presume for 6.x, since that's what was specified).
So similar to the example above, for version 7.x-2.x the template.php file would look something like:
So actually, to be honest, I am not sure if anything is necessary from your end. This is probably a 'working as designed'.
Comment #13
coredumperror CreditAttribution: coredumperror commentedActually, because of the dramatic changes made between 7.x-1.x and 7.x-2.x, that might not be viable any more. Date iCal doesn't use the theme system the same way as it used to, so I don't think the solution in #2 would actually work.
AFter looking through the code, I think I know where I need to manipulate the URL to get rid of unneeded parameters, but it'll take me some time to figure out exactly how to do so.
Comment #14
vlad.pavlovic CreditAttribution: vlad.pavlovic commentedThe code I have posted in #12 is a working example for 7.x-2.x-dev (and worked for 7.x.2.6). The solution works, it's just a different name.
Comment #15
coredumperror CreditAttribution: coredumperror commentedReally? Huh, I didn't realize that would work. Goes to show: even though I've been working with Drupal for nearly two years, I still barely have any idea what I'm doing. ;)