You are here

function cms_content_sync_encrypt_values in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x cms_content_sync.module \cms_content_sync_encrypt_values()
  2. 2.0.x cms_content_sync.module \cms_content_sync_encrypt_values()

Encrypt the provided values. This is used to securely store the authentication password necessary for Sync Core to make changes.

Parameters

array $values: The values to encrypt.

Return value

array The input array, but with encrypted values.

2 calls to cms_content_sync_encrypt_values()
cms_content_sync_install in ./cms_content_sync.install
Implements hook_install().
cms_content_sync_user_password_submit in ./cms_content_sync.module
Update the password at Sync Core if it's necessary for authentication.

File

./cms_content_sync.module, line 1288
Module file for cms_content_sync.

Code

function cms_content_sync_encrypt_values(array $values) {
  $encryption_profile = EncryptionProfile::load(CMS_CONTENT_SYNC_ENCRYPTION_PROFILE_NAME);
  foreach ($values as $key => $value) {
    $values[$key] = Drupal::service('encryption')
      ->encrypt($value, $encryption_profile);
  }
  return $values;
}