Hi,

Problem/Motivation

I create a webform using Term select component. This component is linked to a vocabulary "Subject".

When i tried to submit my webform, i got the following notice :

Notice: Undefined index #target_type in /var/www/html/myproject/modules/contrib/webform/src/Plugin/WebformElement /WebformEntityReferenceTrait.php on line 106

Proposed resolution

The error came from the fact that the property '#target_type' doesn't exist in $element.
It can be fixed by getting the entity type directly on $entity with getEntityTypeId() method.
See the proposed path attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Tsymi created an issue. See original summary.

Tsymi’s picture

Issue summary: View changes
Tsymi’s picture

jrockowitz’s picture

Status: Active » Needs review

@Tsymi Patch makes sense to me. Thanks.

Next time, please just set the ticket's status to 'Needs review' which will trigger the automated tests.

I will commit the patch as soon as all the tests pass.

  • jrockowitz committed cca5e3f on 8.x-5.x authored by Tsymi
    Issue #2862495 by Tsymi: Undefined index #target_type when using Term...
jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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