ValidDynamicReferenceConstraintValidator doesn't pass correct entity to selection handler

Created on 24 July 2025, 10 days ago

Problem/Motivation

I noticed this issue when working on another issue. When validating if a reference is valid, the selection handler is called. (see https://git.drupalcode.org/project/dynamic_entity_reference/-/blob/4.x/s...).

To this selection handler, the entity making the reference needs to be passed (the $entity argument). This argument is instantiated here https://git.drupalcode.org/project/dynamic_entity_reference/-/blob/4.x/s... .

But... it's overridden a bit further on @ https://git.drupalcode.org/project/dynamic_entity_reference/-/blob/4.x/s... .

This means that not the referencing entity is passed to the selection handler, but the last referenced entity.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇧🇪Belgium rp7

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