Hi,
Problem/Motivation
I encountered error 500 below after configuring a display mode on an entity: "TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count() (line 227 of modules/contrib/ui_patterns_settings/src/Form/SettingsFormBuilder.php)."
Steps to reproduce
My project is based on Drupal 9.5, PHP 8.1.
I use the following modules and sub-modules: UI Patterns (version 1.7) / UI Patterns Field Group / Ui Patterns Display Suite and UI Patterns Settings (2.1.0@alpha1)
1) I've added a new field group as a pattern
2) dragged my fields into the field group , I volontary forgot to configure the mappings of my fields with those of the pattern.
3) Saved.
Proposed resolution
The buildStatesForm method of the SettingsFormBuilder class checks if the states variable is other than zero, but in this case it's NULL.
I suggest the patch below to avoid a 500 error and check that the variable is not NULL.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | fix-states-verification-null-to-build-states-form-3378871-2.patch | 623 bytes | martygraphie |
Comments
Comment #2
martygraphie commentedComment #3
christian.wiedemann commented