The referenced entity (taxonomy_term: x) does not exist.

Created on 12 May 2023, over 1 year ago

Problem/Motivation

I cannot edit a node when the referenced taxonomy term was removed.

Steps to reproduce

  1. Install Drupal and enable the shs module
  2. Create a new vocabulary and add some terms
  3. Create a content type with a entity reference field related with the created vocabulary
  4. Create a new node and fill the entity reference field with any term
  5. Remove the selected term
  6. Open the edit form of the node and click to the save button

Proposed resolution

The hidden text input still contains the target_id and caused the error. I propose to remove the method getSelectedOptions() in favor of using it from the parent \Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsSelectWidget

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain nachosalvador Elx

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

Comments & Activities

Production build 0.71.5 2024