Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.Problem/Motivation
Looking at my config YML for a webform with the webform product handler in use, I noticed that a bunch of elements I deleted are still included in third_party_settings.webform_product. I don't think this is doing any real harm, but probably these elements should no longer be in the webform_product settings?
"I don't think this is doing any real harm" -- things I tried so far, to see if I could cause trouble:
- I checked order totals, and they do not include any "top" attribute values from deleted elements.
- I was able to add elements with identical machine names as previously deleted elements -- no errors in my browser or dblog, and the elements seemed to save just fine (regardless of element type).
- And: If I set (or didn't set) a "top" price value, the "top" config attribute value in webform_product config was properly updated to whatever I set on the new version of those fields (i.e. a number, or empty
'').
- And: If I set (or didn't set) a "top" price value, the "top" config attribute value in webform_product config was properly updated to whatever I set on the new version of those fields (i.e. a number, or empty
Steps to reproduce
- Set up a webform with Webform product functionality
- (i.e. create a webform, add the "Order" elements that Webform Product requires (order ID, order status, order URL), add a webform product handler).
- Add one or more elements to your webform -- no need to fill in price info, just add any elements, of any type.
- Export the config YML for your new webform.
- Remove an element (not one of the required "Order" fields, one of the elements you added in step 3).
- Re-export your webform config YML.
- Note that the deleted elements are still included in
third_party_settings.webform_product.
Webform config example:
- Gist: Test webform product form - before and after deleting the "a_second_checkbox" field
- (Two files in this gist, note the filename prefixes "01-before" and "02-after")
- See how in "02-after",
a_second_checkboxis not in theelementsconfig variable.
Proposed resolution
When webform elements are deleted, remove them from webform_product settings/config.
Comments
Comment #2
alison