When an webform Entity reference field is added to node/entity with 'Unlimited' (or Limited > 1) allowed number of value, webform submissions for all except first webform reference are saved without 'Submitted to' (entity_id and entity_type) values.

This is because of following code in QueryStringWebformSourceEntity() getSourceEntity() method that 'Detect and return a source entity from current context':

On line 156:
if ($source_entity->$webform_field_name->target_id != $webform->id()) {
return NULL;
}

This code gets only target_id of first referenced webform, and in case of multiple referenced webforms, if current webform is e.g. second referenced than this code fails and returns null.

Comments

agolubic created an issue. See original summary.

agolubic’s picture

Status: Needs review » Needs work

The last submitted patch, 2: multivalue_webform_reference-3004000-1.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • jrockowitz committed a35e637 on 3004000-query-source-entity
    Issue #3004000 by agolubic: Multiple value Entity reference webform...

  • jrockowitz committed 1ef92f2 on 3004000-query-source-entity
    Issue #3004000 by agolubic: Multiple value Entity reference webform...

  • jrockowitz committed 7454c24 on 3004000-query-source-entity
    Issue #3004000 by agolubic: Multiple value Entity reference webform...
jrockowitz’s picture

Priority: Major » Normal
Status: Needs work » Needs review
StatusFileSize
new16.92 KB

The attached patch adds support for webform fields with multiple values and also includes some refactoring of the related PHPUnit test.

  • jrockowitz committed 0d4c475 on 8.x-5.x
    Issue #3004000 by agolubic, jrockowitz: Multiple value Entity reference...
jrockowitz’s picture

Status: Needs review » Fixed

@agolubic I committed the updated patch. Please download the latest dev release to review.

agolubic’s picture

@jrockowitz
Works great, tnx 😊

Status: Fixed » Closed (fixed)

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