You are here

function webform_encrypt_webform_submission_presave in Webform Encrypt 7

Same name and namespace in other branches
  1. 6 webform_encrypt.module \webform_encrypt_webform_submission_presave()

Implementation of hook_webform_submission_presave(). Encrypt the value if the component has been marked as such.

File

./webform_encrypt.module, line 87
Main module file for the Webform Encrypt module.

Code

function webform_encrypt_webform_submission_presave($node, &$submission) {
  foreach ($submission->data as $cid => $entry) {
    if (!empty($node->webform['components'][$cid]['extra']['encrypt'])) {
      foreach ($submission->data[$cid] as $delta => $value) {
        $submission->data[$cid][$delta] = encrypt($entry[$delta], array(
          'base64' => TRUE,
        ));
      }
    }
  }
}