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.
Problem/Motivation
When visiting the /events/month URI on the attached view I am getting:
Fatal error: Call to a member function getValue() on a non-object in /calendar/src/Plugin/views/row/Calendar.php on line 419
This comes from !empty($field->getValue())
, where it should check the !empty($field)
Proposed resolution
As above, change to !empty($field)
or perhaps:
if (!empty($field) && $date_str = $field->getValue()[0]['value']) {
// ...
$item_start_date->setTimestamp($date_str);
// ...
}
Remaining tasks
Review patch
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#2 | calendar-fix-get-value-fatal-error-views-row-2623494-2-d8.patch | 1.11 KB | mccrodp |
views.view_.content_field_event_date_on_calendar.yml | 16.7 KB | mccrodp |
Comments
Comment #2
mccrodp CreditAttribution: mccrodp as a volunteer commentedComment #3
tedbow@mccrodp thanks for the patch. But these line got changed in #2620898: Remove CalendarDate argument class for arguments in calendar_datetime. Please let me know if you still have the problem
The problem should be fixed. I also created \Drupal\calendar\DateFieldWrapper to take care of issues like this.
Calendar for Drupal 8 still has many problems.
Comment #4
tedbowThis is fixed now
Comment #5
mccrodp CreditAttribution: mccrodp as a volunteer commentedGreat, looks like this is solved, thanks. However I now have: #2625598: Broken Handler on Views Contextual Filter for "Content Field CUSTOM Date on Calendar"