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

  1. Create a webform with elements in the default language.
  2. Add a config translation of the webform elements, or a config override.
  3. Load the webform in the translated language or override context.
  4. Call  $webform->save()  without changing anything.
  5. 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.

Issue fork webform-3633218

Command icon 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

kuldeepbarot created an issue. See original summary.

liam morland’s picture

Version: 6.3.1 » 6.3.x-dev
Status: Active » Needs work
Issue tags: +Needs merge request

Thanks for the patch. Please create a merge request.