protected function FieldEncryptProcessEntities::getUncacheableFields in Field Encryption 8.2
Get field names for an entity that are set to be excluded from cache.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity to check.
Return value
array List of field names that are excluded from cache.
1 call to FieldEncryptProcessEntities::getUncacheableFields()
- FieldEncryptProcessEntities::entitySetCacheTags in src/
FieldEncryptProcessEntities.php - Set the cache tags correctly for each encrypted field on an entity.
File
- src/
FieldEncryptProcessEntities.php, line 427
Class
- FieldEncryptProcessEntities
- Service class to process entities and fields for encryption.
Namespace
Drupal\field_encryptCode
protected function getUncacheableFields(ContentEntityInterface $entity) {
$uncacheable_fields = [];
foreach ($entity
->getFields() as $field) {
if ($this
->checkField($field)) {
/* @var $definition \Drupal\Core\Field\BaseFieldDefinition */
$definition = $field
->getFieldDefinition();
/* @var $storage \Drupal\Core\Field\FieldConfigStorageBase */
$storage = $definition
->get('fieldStorage');
// If uncacheable is set, set caching max-age to 0.
if ($storage
->getThirdPartySetting('field_encrypt', 'uncacheable', FALSE) == TRUE) {
$uncacheable_fields[] = $field
->getName();
}
}
}
return $uncacheable_fields;
}