Error addStateToGroup(): Argument #1 ($new_states) must be of type array, null given

Created on 13 January 2025, 8 days ago

Problem/Motivation

When adding content with paragraphs that have conditional fields, the following error is generated: "TypeError: Drupal\conditional_fields\ConditionalFieldsFormHelper::addStateToGroup(): Argument #1 ($new_states) must be of type array, null given, called in /usr/aplic_ICM/drupal/pcen_drupal/web/modules/contrib/conditional_fields/src/ConditionalFieldsFormHelper.php on line 276 in Drupal\conditional_fields\ConditionalFieldsFormHelper->addStateToGroup() (line 478 of modules/contrib/conditional_fields/src/ConditionalFieldsFormHelper.php)."

Steps to reproduce

Create a paragraph with conditional fields, create a content type with a field that includes the paragraph created above. Create a node of the created content type.

Proposed resolution

Transform the parameter that is sent to the function when it is null to an empty array.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain pascuperbla

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

Comments & Activities

Production build 0.71.5 2024