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 made a calendar view and nodes doesn't appear in year view
This modification works for me (no time to make a patch):
/**
* Build the contents of a single day for the $rows results.
*/
function calendar_build_day($curday, $view, $items, $params) {
$nextday = drupal_clone($curday);
date_modify($nextday, '+1 day');
$inner = '';
resetting selected var, this looks good
$selected = FALSE;
foreach ($items as $date => $day) {
if ($date == date_format($curday, 'Y-m-d')) {
but you should turn on $selected here
$selected = TRUE;
ksort($day);
foreach ($day as $time) {
foreach ($time as $item) {
if (!$view->mini) {
$theme = isset($item->calendar_node_theme) ? $item->calendar_node_theme : 'calendar_node_'. $view->calendar_type;
$inner .= theme($theme, $item, $view);
}
}
}
}
}
if (empty($inner)) {
$inner = theme('calendar_empty');
}
$content = theme('calendar_date_box', date_format($curday, 'Y-m-d'), $view, $params, $selected) . $inner;
return $content;
}
Comments
Comment #1
choster CreditAttribution: choster commentedMarked http://drupal.org/node/256123 as a duplicate of this issue.
Comment #2
Dash CreditAttribution: Dash commentedThanks, this works for me - now to get the ical feed for the year to give me more than just January's events!
For anyone else looking, the file modified here is calendar.inc at line 276-279
Comment #3
scottrigbyGreat - it works!
Yeah, would be good to get the ical feed working as well...
Thanks for the year page view fix in any case - this was really crucial for me
:)
Scott
Comment #4
Dash CreditAttribution: Dash commentedLatest dev snapshot has broken this again for me, even though it is included... :(
Comment #5
Steven Merrill CreditAttribution: Steven Merrill commentedSorry, also in a bit of a rush so I can't patch now, but here's what fixed it on the latest dev release.
Look for the line with //Added.
/**
* Build the contents of a single day for the $rows results.
*/
function calendar_build_day($curday, $view, $items, $params) {
$nextday = drupal_clone($curday);
date_modify($nextday, '+1 day');
$inner = '';
$selected = FALSE;
foreach ($items as $date => $day) {
if ($date == date_format($curday, 'Y-m-d')) {
$selected = TRUE; // Added.
ksort($day);
foreach ($day as $time) {
foreach ($time as $item) {
if (!$view->mini) {
$theme = isset($item->calendar_node_theme) ? $item->calendar_node_theme : 'calendar_node_'. $view->calendar_type;
$inner .= theme($theme, $item, $view);
}
}
}
}
}
if (empty($inner)) {
$inner = theme('calendar_empty');
}
$content = theme('calendar_date_box', date_format($curday, 'Y-m-d'), $view, $params, $selected) . $inner;
return $content;
}
Comment #6
Dash CreditAttribution: Dash commented"As I said.. this is still broken for me with the latest dev (24th June): http://www.skipthebudgie.org/event/2008
My calendar.inc reads as above.
The breadcrumb reads "Home » Gig Calendar » 2008 » January 2008"
AND the iCal feed only shows January events on the year view."
EDIT: Ignore this!!!! I had moved the function into template.php and forgot to change it there... fixed!
Comment #7
KarenS CreditAttribution: KarenS commentedThis seems to be fixed in the latest code. It works for me and #6 indicates it's working there.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #9
Mr P CreditAttribution: Mr P commentedI've got this problem - no underlining or anything else as markers. Day, Week, Month views work fine. Using 6.x-2.x-dev and Dates 6.x-2.x-dev. Gone through the troubleshooting tips. Anyone else? Looked at the code in this post but seems fairly different to latest version. Any fix?
Comment #10
Mr P CreditAttribution: Mr P commentedEDIT: Sorted after latest updates/upgrades.
Comment #11
dirksonii CreditAttribution: dirksonii commentedCannot get these code changes to work with the most recent release. Can anyone post their full 6.x calendar_build_day that the modified? I'm utterly stuck here.
Comment #12
arlinsandbulte CreditAttribution: arlinsandbulte commentedOld issue seems fixed for everyone else.
All seems good to me with latest code.
Comment #13
tms1970 CreditAttribution: tms1970 commentedThis issue is still there (or it has come back!)
I have a calendar with events that show in the month view but don't show in the year view (no events show and nothing is clickable)
If anyone can help i'd be very grateful.
you can see the event calendar here
http://digforvictory.info/bishopsgate/event-created/year
Comment #14
big_smile CreditAttribution: big_smile commentedI am also having the issue of nodes not appearing in Year view. Is there a fix for Drupal 7? I have tried both Dev and Regular versions of the module.
Comment #15
Neslee Canil Pinto