Not working for recursive entity reference fields

Created on 3 May 2024, 5 months ago
Updated 13 May 2024, 5 months ago

Problem/Motivation

This widget is not working for the entity reference field in a paragraph which is inturn referenced inside a content type.

Steps to reproduce

  1. Create a paragraph type with a entity reference field(field_recent_articles - to reference latest articles content type)
  2. Create a paragraph type for hero carousel implementation
  3. Create a content type with entity reference field to the above paragraph types

Content Type > Entity Reference > Paragraph Type > Entity Reference(Trying to apply the widget here) > Node

Now, if we apply the Flexible add more widget to the field_recent_articles and try to use plus icon, it is removing items which are already added in the reference.

Proposed resolution

We should change the below code in the widget src/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php to work on recursive entity references.

    if (!empty($allUserInputValues[$field_name])) {
🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇮🇳India sathishdevan

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