The submission data structure in Webform 4.x has changed, dropping the ['value'] in the array structure. From the webform documentation (Upgrading from Webform 3.x to 4.x):
The $submission->values variable structure changed
In Webform 3.x, values within the Webform $submission variable as retrieved by webform_get_submission() had a structure like the following:Webform 3.x:
$submission->values[$cid]['value'][0] = 'string value';
However in 4.x, the superflous "value" key was eliminated to increase consistency in Webform's internal data structures during form processing.Webform 4.x:
$submission->values[$cid][0] = 'string value';
I can create a patch to address this but it sounds like this should belong in a separate branch?
Comments
Comment #1
Roensby commentedSuggested implementation for the 4.x branch
Comment #2
jweowu commentedHere's a patch based on the original description. I've ignored #1 as clearly too much has changed since then for non-patch code to be useful.
Comment #3
jcuna commentedHere's an updated patch that works with webform 7.x-4.2
It's all minor changes to use webform's new structure omitting the [value] from the array.
Comment #4
jcuna commentedComment #5
jcuna commentedComment #6
jcuna commentedRe-uploading patch with diff. Also deleted extra debug line I forgot.
Comment #7
Steven Brown commented@jcuna
I see in your patch there is a function that is called webform_encrypt_webform_submission_load.
This function does not exist in the original 7.x-1.x branch http://cgit.drupalcode.org/webform_encrypt/tree/webform_encrypt.module?h...
If your code is a working version than you are missing code from the last patch.
I did notice that the patch file from comment #3 is not an actual patch and there is data in there that you are referencing in your last patch.
If this is the case then please create a patch that is a diff between 7.x-1.x and your current code that is working. If you need help in doing so please let me know.
I need this for a client and am glad to help.
Comment #8
jcuna commentedHey FatGuyLaughing
My apologies, didn't even remembered that I had patched the module before as I was having issues loading the encrypted data. The patch I applied never made it to the 1.x branch. There was an issue where the decryption was run while a submission was being rendered, as opposed to loading.
Here's the post for that issue.
https://www.drupal.org/node/1433524
Comment #9
jcuna commentedComment #10
nvahalik commented+1 for #2. Requires that you use the AES module (or at least not the default).
Comment #11
sergei_semipiadniy commentedHi jcuna!
Thanks for your workaround, it helped me a lot. What I did is just remove dpm() and brought better formatting to it.
Again Thanks.
Comment #12
DocVeg commentedWhy are you not publishing it as a new release? Would be helpful for several people. Best regards!
Comment #13
alexfarr commentedHi,
I had some issues with some of these patches on the 7.x-1 branch. I have created a new patch which includes a check for the webform version so this can be used on both webform 3 and 4. Same changes as #2 but includes a check in the install hook for the webform version number, stores this in a variable and uses that in presave hook to save i the correct format.
Comment #14
alexfarr commentedComment #15
heddnRe: #13-14
The approach used to determine the webform version isn't recommended. What happens if webforms is updated? This is a perennial issue for drupal modules. The recommended approach is to tie versions of modules to other versions of modules. In this case, tie 1.x of webform_encrypt to 3.x and 2.x to 4.x (for example). It might also be a good time to add support for encrypt 2.x: #2325353: Compatability with Encrypt 7.x-2.x.
Comment #16
alexfarr commentedI agree with #15, #14 is not the best approach. A webform encrypt 2.x branch would be the best way forward with this tied to encrypt 2.x and webform 4.x. There are also plenty of other patches floating around that can be included, this is a useful module that needs to be kept up to date.
Comment #17
wavesailor commentedHow do I get Webform Encrypt to work with the latest Drupal 7 modules?
I am using:
* Drupal 7.43
* Webform 7.x-4.12
* Encrypt 7.x-2.3
If there isn't a released version, then what patches do I need to apply?
thx
Comment #18
ben.hamelinwavesailor, see https://www.drupal.org/node/2325353#comment-11331777
Comment #19
spadxiii commentedA re-roll of #14. Though I agree with the version bump to just support webform 4 only.
Comment #20
th_tushar commentedThis has been released in 7.x-1.3 version.
Comment #21
th_tushar commented