Events do not show up if state fields were recently added.

Created on 5 April 2020, about 4 years ago
Updated 3 April 2024, 3 months ago

Problem/Motivation

The background call to bat_api/calendar-events fails with an error if one has added a new state field to a Type Bundle and set it to be one of the Event fields on that Type Bundle, but not yet filled set a value into that field for any existing Types of that bundle.

The [static] state fields are usually set to required on the Type Bundles so I can see why the code assumes it should be possible to fetch a value from there and directly call bat_event_load_state() on it, but that function returns FALSE with the error below if there's no value yet.

Error: Call to a member function getCalendarLabel() on null in Drupal\bat_fullcalendar\FullCalendarFixedStateEventFormatter->format() (line 93 of /app/modules/contrib/bat/modules/bat_fullcalendar/src/FullCalendarFixedStateEventFormatter.php).

Proposed resolution

Guard any usage of the return value of bat_event_load_state() by wrapping them in if-statements.

🐛 Bug report
Status

Closed: outdated

Version

10.0

Component

Code

Created by

🇸🇪Sweden TwoD Sweden

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024