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.
Problem/Motivation
In a scenario where you have templates stored for users to build additional webforms with, in a multilingual site these templates can be translated into various languages and works great. The issue I am seeing is when a webform is created from a template, the pre-existing translation stored in the template is not inherited by the child webform.
Example:
Template A has two translations (English, Spanish)
Webform A is created from Template A but only has the default language (English)
Hope this makes sense, and thanks,
Mark
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#11 | webforms_created_from-2884658-11.patch | 2.92 KB | jrockowitz |
| |||
#7 | webforms_created_from-2884658-7.patch | 1.31 KB | jrockowitz |
|
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedMakes complete sense to me but it is not easy to do because Webform config entities (compare to content entities) don't expose any meta data about translations.
We are going to have to look at the ConfigTranslationController and figure out how to duplicate all the translated configuration files.
Comment #3
md2 CreditAttribution: md2 commentedHi @jrockowitz,
Is there anything I can do to help move this issue forward? I'm not overly familiar with the ConfigTranslationController and how it would relate to webforms config files but willing to help if I can.
~Mark
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@md2 Not too many people are familiar with the inner workings of config translation.
Luckily, I am starting to work with Lingotek which is going to motivate me to start addressing multilingual issues next month.
Comment #5
md2 CreditAttribution: md2 commented@jrockowitz, If there is anything I can test / help test / investigate please just let me know, keen to help push this issue forward! :)
Thanks for such a great D8 version of the module btw.
~Mark
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe method that needs to be updated is \Drupal\webform\Entity\Webform::createDuplicate.
Duplicating config entity translations is not being handled by any module. I am pretty sure duplicating a translated Views or Contact Form does not duplicate the translations.
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI could not figure out the "right way" to duplicate translated config. Attached is a patch that uses a poor-mans workaround that directly copies the config records stored in the database.
I should be able to write some tests that verify the workaround is acceptable.
Comment #10
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedAttached is the same patch with test coverage.... my workaround still feels dirty. At least there are tests that applicable when we properly fix this issue.
Comment #11
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #13
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch. Please download the latest dev release to review.