You are here

function webform_encrypt_webform_submission_presave in Webform Encrypt 6

Same name and namespace in other branches
  1. 7 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 85
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'])) {
      $submission->data[$cid]['value'][0] = encrypt($entry['value'][0], array(
        'base64' => TRUE,
      ));
    }
  }
}