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

Created on 10 January 2024, 6 months ago
Updated 28 February 2024, 4 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

Closed: cannot reproduce

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

Comments & Activities

Production build 0.69.0 2024