Argument #1 ($form_values) must be of type array, null given

Created on 29 May 2024, 7 months ago
Updated 21 June 2024, 6 months ago

Problem/Motivation

In conjunction with the module simple_multistep (and probably any other multistep form module) Drupal throws an error when using this module in a multistep form.

TypeError: Drupal\group_by_field_widget\Plugin\Field\FieldWidget\GroupByFieldReferenceWidget::flattenFormValues(): Argument #1 ($form_values) must be of type array, null given, called in /var/www/html/web/modules/contrib/group_by_field_widget/src/Plugin/Field/FieldWidget/GroupByFieldReferenceWidget.php on line 270 in Drupal\group_by_field_widget\Plugin\Field\FieldWidget\GroupByFieldReferenceWidget->flattenFormValues() (line 310 of /var/www/html/web/modules/contrib/group_by_field_widget/src/Plugin/Field/FieldWidget/GroupByFieldReferenceWidget.php).

Typically in a single form all form field values (also the empty ones) are set in one array. Not so in a multistep form. This module tries to get access also to the non-available field values, which throws then above error.

Steps to reproduce

1. Install simple_multistep
2. Create a multistep form
3. Create a grouped reference field
4. Switch between the form steps and/or try to save the filled form

Proposed resolution

🐛 Bug report
Status

Fixed

Version

1.2

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024