You are here

function field_encrypt_entity_type_alter in Field Encryption 8.2

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

Implements hook_entity_type_alter().

File

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

Code

function field_encrypt_entity_type_alter(array &$entity_types) {
  $uncacheable_types = \Drupal::state()
    ->get('uncacheable_entity_types');
  if ($uncacheable_types) {

    // Mark entity types uncacheable if they contain an encrypted field
    // that has been marked uncacheable.
    // See Drupal\field_encrypt\EventSubscriber\ConfigSubscriber
    // setUncacheableEntityTypes().
    foreach ($uncacheable_types as $uncacheable_type) {
      $entity_types[$uncacheable_type]
        ->set('static_cache', FALSE);
      $entity_types[$uncacheable_type]
        ->set('render_cache', FALSE);
      $entity_types[$uncacheable_type]
        ->set('persistent_cache', FALSE);
    }
  }
}