Problem/Motivation
Encountering following error: Warning: Trying to access array offset on value of type null in datetime_range_entity_view_display_presave() (line 57 of core/modules/datetime_range/datetime_range.module).
This seems to happen because we use extra fields via (extra_field_plus / Frontend Editing)
Extra fields don't seem to provide a field formatter - but the datetime_range code assumes that there's always one:
if (!in_array($plugin_definition['class'], $daterange_formatter_classes, FALSE)) {
According to \Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinition()
it is valid to return NULL, especially if $exception_on_invalid
is set to FALSE - which our code does.
For 11.x this is obsolete due: 3442162
Steps to reproduce
Proposed resolution
Add a check for $plugin_definition['class']
.
Remaining tasks
- ✓ Writing code
- Reviews
- Merge
User interface changes
None
Introduced terminology
None
API changes
None
Data model changes
None