By working closely against D7 Calendar, I've updated Calendar 8-dev so that calendars display multi-day events as expected.
However - my solution so far is not nearly ready to commit, so I'm starting this thread (after discussion w/ pjonckiere) simply to spark discussion/work. I'm fairly confident I've isolated the areas which need changing, less confident that my changes are correct (even if they work).
And one major caveat - my working calendar relies on brute hardcoding of some field values in CalendarHelper::dateViewFields. Haven't quite cracked that problem yet.
As an overview: a key to understanding Calendar is found in /src/Plugins/views/style/Calendar.php in function render(). This is where src/Plugins/views/row/Calendar.php function render() (and prerender) are called on. Note this code, with original 8.x-1.x-dev lines commented out:
foreach ($this->view->result as $row_index => $row) {
$this->view->row_index = $row_index;
$events = $this->view->rowPlugin->render($row);
// @todo Check what comes out here.
/** @var \Drupal\calendar\CalendarEvent $event_info */
foreach ($events as $event_info) {
$item_start = $event_info->calendar_start_date->format('Y-m-d');
//$item_start = $event_info->getStartDate()->format('Y-m-d');
$item_end = $event_info->calendar_end_date->format('Y-m-d');
//$item_end = $event_info->getEndDate()->format('Y-m-d');
$time_start = $event_info->calendar_start_date->format('H:i:s');
//$time_start = $event_info->getStartDate()->format('H:i:s');
$event_info->setRenderedFields($this->rendered_fields[$row_index]);
$items[$item_start][$time_start][] = $event_info;
}
The entity being placed on the calendar has event_info->start_date and event_info->end_date (which of course can be the same as the start date). These are being called in the commented out lines via $event_info->getStartDate() etc. However, Calendar requires that the entity also have a "calendar_start_date" and a "calendar_end_date". Later, in calendarBuildWeekDay(), the entity->start_date is compared to entity->calendar_start_date to determine whether we have an event spanning multiple days or not (ditto the end_date & calendar_end_date).
Once you've gleaned that, travel over to /src/Plugins/views/row/Calendar.php, where the heavy lifting happens in the prerender(), render(), and explode_values() functions.
A couple of other overall notes:
- working on this requires
#2161337: Add a Date Range field type with support for end date β
patch #90
- I haven't addressed any of the pre-existing to-do's in Calendar dev - hardcoding of granularities and so on
- recommend grabbing Calendar 7.x-3.5 for full comparison if you're trying to grasp 8