You are here

public function FieldEncryptProcessEntities::entitySetCacheTags in Field Encryption 8.2

Set the cache tags correctly for each encrypted field on an entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity whose fields to set cache tags on.

$build: The entity render array.

Overrides FieldEncryptProcessEntitiesInterface::entitySetCacheTags

File

src/FieldEncryptProcessEntities.php, line 411

Class

FieldEncryptProcessEntities
Service class to process entities and fields for encryption.

Namespace

Drupal\field_encrypt

Code

public function entitySetCacheTags(ContentEntityInterface $entity, &$build) {
  $uncacheable_fields = $this
    ->getUncacheableFields($entity);
  foreach ($uncacheable_fields as $field_name) {
    $build[$field_name]['#cache']['max-age'] = 0;
  }
}