Config schema issue and errors from datetime_range_entity_view_display_presave

Created on 16 September 2024, 7 months ago

Problem/Motivation

When exporting display configs containing extra fields, we get config validation errors.
These can be seen with config_inspector.

Violations are of type: The '@plugin_id' plugin does not exist (where @plugin_id is extra_field_{name}).

See schema definitions for core.entity_view_display.*.*.*, field_formatter.entity_view_display, field_formatter
There is a constraint on field_formatter "type":

field_formatter:
  type: mapping
  label: 'Field formatter'
  mapping:
    type:
      type: string
      label: 'Format type machine name'
      constraints:
        PluginExists:
          manager: plugin.manager.field.formatter
          interface: 'Drupal\Core\Field\FormatterInterface'

But these extra fields are not formatter plugins, hence we get the error.

---

Another side effect is that on 10.3.x, since Add option to show only start or end date in the DateTime Range custom formatter Needs review , PHP warnings are being logged from datetime_range_entity_view_display_presave because the code there expects to see field formatters:

[warning] Trying to access array offset on null datetime_range.module:57

This is apparently removed in 11.x from 📌 Remove redudundat hook_ENTITY_TYPE_presave() and ViewsConfigUpdater methods Active .
But still... core expects everything under content to be formatter plugins.

Steps to reproduce

See above (export displays with extra fields and run config_inspector).
On saving displays, you should see the error from datetime_range, if the module is enabled.

Proposed resolution

TBD/TODO...

Remaining tasks

?

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇧🇪Belgium herved

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

Comments & Activities

  • Issue created by @herved
  • 🇧🇪Belgium herved

    Sadly, I don't have time to work on this right now, and didn't investigate potential solutions.
    So if anyone wants to work on it and/or propose an approach, you are most welcome :)

Production build 0.71.5 2024