You are here

function field_encrypt_test_field_encrypt_unencrypted_storage_value_alter in Field Encryption 3.0.x

Implements hook_field_encrypt_unencrypted_storage_value_alter().

File

tests/modules/field_encrypt_test/field_encrypt_test.module, line 88
Contains module hooks for field_encrypt_test.

Code

function field_encrypt_test_field_encrypt_unencrypted_storage_value_alter(&$unencrypted_storage_value, array $context) {
  if (\Drupal::state()
    ->get('field_encrypt_test.hook_field_encrypt_unencrypted_storage_value_alter', FALSE)) {
    $entity = $context['entity'];
    $field = $context['field'];
    $property = $context['property'];
    \Drupal::messenger()
      ->addMessage("Value alter hook: Entity title: {$entity->label()}");
    \Drupal::messenger()
      ->addMessage("Value alter hook: Field name: {$field->getName()}");
    \Drupal::messenger()
      ->addMessage("Value alter hook: Property: {$property}");
    $unencrypted_storage_value = '🐒';
  }
}