You are here

function field_encrypt_entity_presave in Field Encryption 3.0.x

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

Implements hook_entity_presave().

Encrypt entity fields before they are saved.

File

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

Code

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