Warning: 'Undefined array key' on page 'Manage form display' when changing field settings.

Created on 10 January 2024, 11 months ago

Problem/Motivation

On the page 'Manage form display' /admin/structure/types/manage/TYPE/form-display, an error appears when the settings for ComplexWidget or WeekWidget are changed.

The following warning appears:
Warning: Undefined array key "FIELD_NAME" in Drupal\field_ui\Form\EntityDisplayFormBase->copyFormValuesToEntity()
after that some follow-up messages:
Warning: Trying to access array offset on value of type null in Drupal\field_ui\Form\EntityDisplayFormBase->copyFormValuesToEntity() (line 6XX of ...\core\modules\field_ui\src\Form\EntityDisplayFormBase.php).

The field name is the name of the subsequent field in the list.
When debugging the named function, wwe see that the $formstate->getValue() returns the list of fields, indeed without the subsequent field.

A code comparison with the core FieldWidget with id = "entity_reference_autocomplete" gives no important differences, other than:
- in Annotation, a description is missing
- in Annotation, no trailing comma's after the field_types list.

🐛 Bug report
Status

Active

Version

1.0

Component

Code - widget

Created by

🇳🇱Netherlands johnv

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