You are here

public function ProcessEntities::entitySetCacheTags in Field Encryption 3.0.x

Sets an entity's encrypted field's cache tags appropriately.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity being viewed.

array $build: A renderable array representing the entity content.

See also

field_encrypt_entity_view()

File

src/ProcessEntities.php, line 332

Class

ProcessEntities
Service class to process entities and fields for encryption.

Namespace

Drupal\field_encrypt

Code

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