Some of my form submissions have langcode being set while others are not setting getting the langcode set. Apparently when the langcode is not set on a submission, some of the stuff ends up breaking in the backend. I was going to do some debugging but thought I'd first ask to see if anyone else has had this problem or know what might be the source of this issue.

Comments

mcpuddin created an issue. See original summary.

jrockowitz’s picture

WebformSubmission langcode is set via \Drupal\webform\Entity\WebformSubmission::preCreate() and it can be easily overridden. The code and logic in WebformSubmission::preCreate() is pretty old and might need to be tweaked or even removed.

mcpuddin’s picture

Category: Support request » Bug report

Alright so I found the bug, and it's basically in WebformAddress. WebformAddress is a composite of Drupal's Address. Drupal's Address is injecting a langcode element in Address::processAddress:

    $element['langcode'] = [
      '#type' => 'hidden',
      '#value' => $value['langcode'],
    ];

Because that's there, the langcode unsets the webform submissions langcode on a submission. And when langcode isn't set on a submission, the submissions table breaks.

jrockowitz’s picture

The below ticket should have eliminated all webform element namespacing conflicts.

#2848042: Rework #type shorthand prefix handling

BTW, the devel module makes it very easy to see all the render elements available via /devel/elements.

On your site, is there an 'address' element? Who is the provider for this element?

mcpuddin’s picture

So it's the address module actually: https://www.drupal.org/project/address

jrockowitz’s picture

Try the latest beta6 release. You will need to run the update hook which changes '#type': address to '#type': webform_address

mcpuddin’s picture

Looks promising! Initial tests shows that those changes helped out. Will let you know once I do more testing.

Thanks!

jrockowitz’s picture

Status: Active » Fixed

I am almost certain that this is fixed in the latest beta6 release. Please reopen, if you are still having problems.

mcpuddin’s picture

Confirm, fixed!

Status: Fixed » Closed (fixed)

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