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
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | form-validate-array-check-01.patch | 2.28 KB | fastangel |
| form-validate-array-check.patch | 2.32 KB | ross-zch |
Issue fork conditional_fields-3383186
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ross-zch commentedComment #3
fastangel commentedI attach patch compatible with last version