I'm sorry in advance for this description, I have very little time to elaborate. In our custom code we need access to the webform submission entity in an entity reference select plugin. This is only possible if the webform reference fields pass this on, which they're not doing currently. With the webform submission we can then access the originating entity. I hope the before makes sense. I have a patch which adds the webform submission to webform entity reference fields.

When time permits I'll try to update this ticket.

Comments

dagomar created an issue. See original summary.

dagomar’s picture

dagomar’s picture

StatusFileSize
new5.24 KB
jrockowitz’s picture

Status: Active » Needs review
jrockowitz’s picture

StatusFileSize
new638 bytes

Does the attached patch accomplish the same goal of passing the webform submission to the entity reference select plugin without adding the extra parameter?

casey’s picture

StatusFileSize
new1.13 KB

Yes that would work. This patch also contains the actual passing of the entity to the selection handler.

jrockowitz’s picture

StatusFileSize
new1.13 KB

We still need to support PHP 6 until 8.7 is the only support version, therefore I change ?? to ?:

jrockowitz’s picture

Now that I am reviewing the changes from #6, I am not sure why you can't use '_webform_settings'.

jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

casey’s picture

'entity' is a (undocumented) default option. See \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getSelectionHandler()

Even though webform elements are no real entity fields, they (their values) do belong to webform submissions. Selection handlers can use this information to filter the referenceable entities.

casey’s picture

StatusFileSize
new728 bytes
casey’s picture