Fix issue with entity browser widget not updating target_id correctly when cardinality is 1

Created on 15 October 2024, 4 months ago

Problem/Motivation

There is an issue with the EntityReferenceBrowserWidget where the target_id is not being reset correctly when an entity is removed, and the modal does not open correctly when adding a new entity if the field's cardinality is set to 1.

Steps to reproduce

  1. Create a field with EntityReferenceBrowserWidget and set its cardinality to 1.
  2. Add an entity using the entity browser.
  3. Remove the entity.
  4. Try to add a new entity.

Expected Behavior:
The target_id should be reset when an entity is removed.
The modal should open correctly when adding a new entity.
Actual Behavior:
The target_id is not reset when an entity is removed.
The modal does not open correctly when adding a new entity.

Proposed resolution

  1. Ensure that the target_id is reset when an entity is removed.
  2. Update the #default_value of the target_id element to handle the case when no entities are present.
  3. Ensure the modal opens correctly when adding a new entity.
πŸ› Bug report
Status

Needs work

Version

2.10

Component

Field widget

Created by

πŸ‡ΊπŸ‡¦Ukraine v.dovhaliuk

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

Comments & Activities

Production build 0.71.5 2024