Error thrown when date field has a dependency on select list

Created on 24 August 2023, 10 months ago

Problem/Motivation

An error is thrown when adding a date field as a dependency on a select list field. I have also reproduced the error when date field has a dependency on bool fields.

Error: Cannot use object of type Drupal\Core\Datetime\DrupalDateTime as array in Drupal\conditional_fields\ConditionalFieldsFormHelper::formValidate() (line 748 of modules/contrib/conditional_fields/src/ConditionalFieldsFormHelper.php).

Steps to reproduce

1. Create a new paragraph type, add an optional date (date only) field and a select list field
2. Add a dependency to make the date field controlled by the select list - invisible depending on value
3. Enable the paragraph on a node, then create node with the paragraph and choose the select list option that causes the date field to turn invisible
4. Save the page.

Proposed resolution

Add patch to check if $field_values_location is array in ConditionalFieldsFormHelper.php

πŸ› Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom ross-zch

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

Comments & Activities

Production build 0.69.0 2024