EntityDisplayFormBase::buildFieldRow() resaves config for hidden field without any valid plugins

Created on 9 September 2019, almost 5 years ago
Updated 31 January 2023, over 1 year ago

If a new field type is added to an entity that does not have any valid widgets or formatters, and this field type is configured as hidden/disabled in the form or view display, this causes \Drupal\field_ui\Form\EntityDisplayFormBase::buildFieldRow() to re-save the config of the form or view display whenever the page is loaded, even though there is nothing to save. We found this when the Bynder module β†’ added a new field type to its media entity type without adding any widgets or formatters. We never set this field to be displayed, and when we had the Configuration Read-Only module β†’ enabled, we got a fatal error when viewing the "Manage form display" and "Manage display" tabs of the media type.

Proposed Solution

Since in this case, the config save would be a no-op anyway, skip saving the config if the field is not configured for display at all.

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
Field UIΒ  β†’

Last updated 5 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States Dave Reid Nebraska πŸ‡ΊπŸ‡Έ

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.71.5 2024