datetime_range throwing error in datetime_range_entity_view_display_presave()

Created on 1 November 2024, 11 months ago

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 πŸ“Œ Remove redudundat hook_ENTITY_TYPE_presave() and ViewsConfigUpdater methods Active

Steps to reproduce

Proposed resolution

Add a check for $plugin_definition['class'].

Remaining tasks

  1. Writing code
  2. Reviews
  3. Merge

User interface changes

None

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

πŸ› Bug report
Status

Active

Version

10.5 ✨

Component

datetime.module

Created by

πŸ‡¨πŸ‡­Switzerland das-peter

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024