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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

johnv created an issue. See original summary.

  • johnv committed 2afc1168 on 8.x-1.x
    Issue #3413697: Warning: 'Undefined array key' on page 'Manage form...
johnv’s picture

Priority: Normal » Minor

Above patch does not sovle anything, just adds the annotation description, reorder functions and updates // @todo comments

johnv’s picture

It is assumed that the problem is caused by #3401667: Multiple Office Hours fields on same Content Type breaks Exceptions.
But this is not confirmed, and the version 8.x-1.11 must be tested, to see if already happens there.

johnv’s picture

Status: Active » Closed (cannot reproduce)

I cannot reproduce it anymore.

josedsilva’s picture

Version: 8.x-1.x-dev » 8.x-1.19
Status: Closed (cannot reproduce) » Active

This issue has reappeared on Drupal 10.x.
It occurs when clicking the settings icon in "Manage Form Display" when all of the following conditions are satisfied:
1. The office hours field is used in a paragraph
2. There are other fields in the same paragraph (e.g. a Text (Plain) field)
3. Widget type is either "Office hours (week) with exceptions and seasons" or "Office hours (week)"

NOTE:
If office hours field is the only field used in the paragraph then there is no issue.
Add a second field to the paragraph and the issue will show.

josedsilva’s picture

clarkssquared’s picture

Hi

Im using Drupal Core version 10.1.8 but I can't seem to replicate the error.

johnv’s picture

Title: Warning: 'Undefined array key' on page 'Manage form display' when changing field settings. » Paragraphs & OH: Warning: 'Undefined array key' on page 'Manage form display' when changing field settings

  • johnv committed 0d30874b on 8.x-1.x
    Issue #3413697 by josedsilva: Paragraphs...
johnv’s picture

Status: Needs review » Fixed

The patch effectively removes all initial settings in the 'settingsform'. That seems a bit rude and tricky.
OTOH I cannot find a new problem.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.