Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hi, I using the calendar block display and since I have only one event per day, I would like to link the days (only those which have events) on the mini calendar directly to their events.
I found an issue regarding the same idea but it's about an older version of the Project.
However, I found a function called template_preprocess_calendar_datebox where I got the basic idea but I was unable to put the node link into the vars['url'] variable.
Thanks,
matthew
Comments
Comment #1
matthewdades CreditAttribution: matthewdades commentedComment #2
matthewdades CreditAttribution: matthewdades commentedAny hint would be appreciated
Thanks
Comment #3
capellicThere isn't any setting within Views as far as I can tell. Instead, copy the calendar-datebox.tpl.php file into your theme and then you can change the link in there. Here's what it looks like after I was done with it:
Comment #4
lizuka CreditAttribution: lizuka commentedthanks for this piece of code, it's much appreciated !
any ideas on how to format this particular link to set it to the calendar page on the month of the events of that current day ?
something along the lines of :
$output = l($day, 'calendar/' . $date);
where $date is the year - month value.
Comment #5
michelepotvin CreditAttribution: michelepotvin commentedHi, thanks for the info.
I am also trying to link the mini calendar dates to their respective events instead of the day calendar.
Although I cant seem to link to the proper path, (how do I find it???)
as in $output = l($day,
'events/upcoming/'
. $date);
here is a link to the website
http://placide.charlem.com/
Thank you for any help.
Comment #6
bogdanru CreditAttribution: bogdanru commentedIf it is 1 event/day, u can set the url of the node same as the $output. It is a simple one, but it works.
Comment #7
blackandcode CreditAttribution: blackandcode commentedIf someone wants to make mini calendar block display only one node and link it to a day than this is code you need:
print $class;
">print !empty($selected) ? $link : $day;
Comment #8
yannickooI also want to link a day to it's event if one is available, here is my code for
calendar-datebox.tpl.php
file:Comment #9
Rhicreate CreditAttribution: Rhicreate commentedCode in comment #8 seems to work well in Drupal 7, whereas the earlier code did not work on my install.
Comment #10
mist CreditAttribution: mist commentedThank you for good solution :-)
Comment #11
Mabuy CreditAttribution: Mabuy commentedThank you for the solution #8. It works well. I'm using Calendar 7.x-3.4. However, I would like to benefit from the colorbox version as provided when one clicks on an item's title in the Day display: this gives a popup window with arrows to look at other items occuring the same say. So it would be possible to handle the case of multiple events per day. Could anyone provide the code for this ?
Comment #12
hoangbien CreditAttribution: hoangbien commentedIt work fine. thank you very much,
Comment #13
shortspoken CreditAttribution: shortspoken commented#8 Workin' just fine! Thanks!
Comment #14
jonodunnett CreditAttribution: jonodunnett commented#8 works fine for me too. Also thanks.
re #11, it is easy enough to get the link to launch in colorbox using
$link = l($day, 'node/' . $entity->id, array('attributes' => array('rel' => array('colorbox-gallery'), 'class' => array('colorbox'),'title' => $entity->title)));
in place of
$link = l($day, 'node/' . $entity->id, array('attributes' => array('rel' => array('title' => $entity->title)));
But this reopens a new fully rendered page in the colorbox. What would be nice is to just render the node and have this open in a colorbox, which I don't know how to achieve.
Comment #15
Pandelon CreditAttribution: Pandelon as a volunteer commentedCan someone give me a Drupal 8 code for this problem? (or can it be solve other way?)
Comment #16
gauravkhambhala CreditAttribution: gauravkhambhala commented@Pandelon,
for Drupal 8: Copy calendar-datebox.html.twig from yourdrupalrootdir/modules/calendar/templates to you theme's templates directory.
Have below code into that file. The code below will generate link as /month-list/201803/27 You can change the href to your needs.
Comment #17
shaktikThanks this works great.
Comment #18
Neslee Canil Pinto