Problem/Motivation
When a webform is loaded with config overrides applied, such as a config translation in the current language or a $config override in settings.php, the overlaid values are held in the entity. Calling $webform->save() then writes those overlaid values to the stored config. This silently replaces the original-language elements , title , description or settings with the translated or overridden version. It is most visible in bulk operations, programmatic saves, and saves made while a non-default language is active.
Steps to reproduce
- Create a webform with elements in the default language.
- Add a config translation of the webform elements, or a config override.
- Load the webform in the translated language or override context.
- Call $webform->save() without changing anything.
- Compare the stored config ( drush cget webform.webform.ID --include-overridden=false ). It now contains the translated or overridden values.
Proposed resolution
- In Webform::postLoad() , compare title , description , elements and each settings key with the override-free stored config ( getOriginal(NULL, FALSE) ). Remember any values that differ.
- In Webform::preSave() , for existing entities, restore the stored value for each remembered property whose current value is still the unmodified overlaid value. Values the user changed are saved as normal.
Remaining tasks
User interface changes
None
API changes
A new protected property Webform::$overlaidValues and a protected method Webform::restoreOverlaidValues() . There are no public API changes.
Data model changes
None. Stored config is no longer polluted with overlaid values.
| Comment | File | Size | Author |
|---|---|---|---|
| webform-save-without-config-override-values.patch | 2.98 KB | kuldeepbarot |
Issue fork webform-3633218
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
liam morlandThanks for the patch. Please create a merge request.