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.
Issue fork office_hours-3413697
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
Comment #3
johnvAbove patch does not sovle anything, just adds the annotation description, reorder functions and updates
// @todocommentsComment #4
johnvIt 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.
Comment #5
johnvI cannot reproduce it anymore.
Comment #6
josedsilvaThis 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.
Comment #8
josedsilvaPatch: https://git.drupalcode.org/project/office_hours/-/merge_requests/46.patch
Comment #9
clarkssquared commentedHi
Im using Drupal Core version 10.1.8 but I can't seem to replicate the error.
Comment #10
johnvComment #12
johnvThe patch effectively removes all initial settings in the 'settingsform'. That seems a bit rude and tricky.
OTOH I cannot find a new problem.