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.

Comments

Martygraphie created an issue. See original summary.

martygraphie’s picture

christian.wiedemann’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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