You are here

protected function StateManager::setEntityTypeCacheInformation in Field Encryption 3.0.x

Sets the last installed entity cache information correctly.

Parameters

string[] $entity_type_ids: The entity type IDs to set the cache information for.

See also

field_encrypt_entity_type_alter()

2 calls to StateManager::setEntityTypeCacheInformation()
StateManager::onFieldEncryptSettingsCacheChange in src/StateManager.php
Reacts to field_encrypt.settings:make_entities_uncacheable changes.
StateManager::update in src/StateManager.php
Figure out which entity types are encrypted.

File

src/StateManager.php, line 139

Class

StateManager
Manages state for the module.

Namespace

Drupal\field_encrypt

Code

protected function setEntityTypeCacheInformation(array $entity_type_ids) {
  $entity_types = $this->entityTypeManager
    ->getDefinitions();

  // Types that have changed need to have their last installed definition
  // updated. We need to be careful to only change the settings we are
  // interested in.
  foreach ($entity_type_ids as $type) {
    $last_installed_definition = $this->entitySchemaRepository
      ->getLastInstalledDefinition($type);
    $last_installed_definition
      ->set('render_cache', $entity_types[$type]
      ->get('render_cache') ?? FALSE)
      ->set('persistent_cache', $entity_types[$type]
      ->get('persistent_cache') ?? FALSE);
    $this->entitySchemaRepository
      ->setLastInstalledDefinition($last_installed_definition);
  }
}