EntityAutocompleteTagify returns wrong value so Drupal tries to create entity without label

Created on 18 June 2025, 24 days ago

Problem/Motivation

We're trying to use Tagify on an entity form which was converted to a multi-step form (with Simple Multi Step Form β†’ ). This form has two "steps", first one reveals all the entity fields the users have to fill in, and the second step is only a confirmation.

When the first step is submitted, the widget seems to work properly, the EntityAutocompleteTagify returns the right field value. But, when the second (last) step is also submitted, the calculated value will be wrong

  1. Unfortunately, since the second step does not reveals any field, in EntityAutocompleteTagify::valueCallback() will go into the body of the first condition (because $input will be FALSE).
  2. The element at #default_value will already contain all the preexisting and the new entities.
  3. But, EntityAutocompleteTagify::getTagifyDefaultValue does not handle new entities the right way. I checked how core's EntityAutocomplete does this and if the entity is new, then it returns the label of the entity at the value key.

Anyway, we're getting storage exception because (core's) EntityReferenceItem tries to create the term without label.

I am not convinced that this is really a Tagify issue, I'm just filing this ticket here because core's entity autocomplete widget does not have this problem.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.2

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary huzooka Hungary πŸ‡­πŸ‡ΊπŸ‡ͺπŸ‡Ί

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024