You are here

function field_encrypt_entity_presave in Field Encryption 8.2

Same name and namespace in other branches
  1. 3.0.x field_encrypt.module \field_encrypt_entity_presave()

Implements hook_entity_presave().

Encrypt entity fields before they are saved.

File

./field_encrypt.module, line 178
Contains module hooks for field_encrypt.

Code

function field_encrypt_entity_presave(EntityInterface $entity) {
  if (field_encrypt_allow_encryption($entity)) {
    \Drupal::service('field_encrypt.process_entities')
      ->encryptEntity($entity);
  }
}