Not working with entity_reference_autocomplete

Created on 3 February 2021, about 4 years ago
Updated 15 May 2023, almost 2 years ago

Problem/Motivation

When applying field states on a multi value entity_reference field with the entity_reference_autocomplete formatter, I can not add new entities because the "Add another item" button throws an error:

TypeError: Argument 1 passed to Drupal\Core\Field\WidgetBase::getWidgetState() must be of the type array, null given, called in /.../web/core/lib/Drupal/Core/Field/WidgetBase.php on line 300 in Drupal\Core\Field\WidgetBase::getWidgetState() (Zeile 484 in /.../web/core/lib/Drupal/Core/Field/WidgetBase.php)

Steps to reproduce

Add a multi-value entity reference field with the formatter entity_reference_autocomplete and apply field states. Try to hit the button "Add another item" and watch the console.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇩🇪Germany daveiano

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024