You are here

private function FieldEncyptCacheTrait::encrypt in Field Encryption 7

Encrypts the data for the Cache backend.

Parameters

mixed $data: Decrypted data.

Return value

string Encrypted data string.

1 call to FieldEncyptCacheTrait::encrypt()
FieldEncryptDatabaseCache::set in ./field_encrypt.cache.inc
Implements DrupalCacheInterface::set().

File

./field_encrypt.cache.inc, line 22
Field encryption cache classes.

Class

FieldEncyptCacheTrait
Class FieldEncyptCacheTrait.

Code

private function encrypt($data) {
  if (!is_string($data)) {
    $data = serialize($data);
  }

  // Encrypt the data just before it's saved.
  module_load_include('inc', 'field_encrypt');
  return field_encrypt_encrypt($data);
}