Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedWebformSubmission 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.
Comment #3
mcpuddin CreditAttribution: mcpuddin commentedAlright 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:
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.
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe 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?
Comment #5
mcpuddin CreditAttribution: mcpuddin commentedSo it's the address module actually: https://www.drupal.org/project/address
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedTry the latest beta6 release. You will need to run the update hook which changes
'#type': address
to'#type': webform_address
Comment #7
mcpuddin CreditAttribution: mcpuddin commentedLooks promising! Initial tests shows that those changes helped out. Will let you know once I do more testing.
Thanks!
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI am almost certain that this is fixed in the latest beta6 release. Please reopen, if you are still having problems.
Comment #9
mcpuddin CreditAttribution: mcpuddin commentedConfirm, fixed!