Using a custom content entity and date field, I'm getting the following errors and calendar items do not render:

Notice: Undefined variable: rows in Drupal\calendar\Plugin\views\row\Calendar->render() (line 552
Warning: Invalid argument supplied for foreach() in Drupal\calendar\Plugin\views\style\Calendar->render() (line 544

Comments

eswiderski created an issue. See original summary.

Anonymous’s picture

StatusFileSize
new465 bytes

The warning is caused by the rows variable that is not initialised if no date fields or events are found. It can be prevented by properly initialising it (see patch), however, this off course still won't show the events you are expecting.
Could you provide more information on how you created the custom entity and view, so I can try reproducing the issue?

sonoutlaw’s picture

I'm having this same issue. I used ECK and I have a bundle with a date field. I can create a calendar view from template with the date field, but no entities display on the calendar. I can switch the format to Unformatted list and see the entities.

I added a date field to the Page content type, created a view from template and everything works. So maybe it's an issue with ECK?

yepa’s picture

Having the same issue with commerce product entities \)

yepa’s picture

Title: Custom Content Entity » Custom Entity not displayed
Assigned: Unassigned » yepa
Priority: Normal » Major
yepa’s picture

Assigned: yepa » Unassigned
Status: Active » Needs review
StatusFileSize
new1 KB

Solved ;)

yepa’s picture

StatusFileSize
new1 KB
howards’s picture

I happened to be developing using a taxonomy set to be calendarizing items; items didn't appear before this patch. This patch appears to use the entity system more appropriately than specifically touching the node entity. This patch fixed the issue with the taxonomy entity hosting date/datetime fields for calendar items (datetime_range, honestly) and I assume it works for custom entities since that was the OP's issue.

This patch has now been incorporated into a build stream. Thank you, yepa!

yepa’s picture

Status: Needs review » Reviewed & tested by the community

Happy to help ;)

yepa’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
yepa’s picture

Status: Patch (to be ported) » Reviewed & tested by the community
mortona2k’s picture

Works for me! Showing a product variation w/ date field on the calendar.

solide-echt’s picture

Version: 8.x-1.x-dev » 8.x-1.0-alpha2
Assigned: Unassigned » solide-echt
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.