EntityFieldManager::clearCachedFieldDefinitions

public EntityFieldManager::clearCachedFieldDefinitions()

Clears static and persistent field definition caches.

Overrides EntityFieldManagerInterface::clearCachedFieldDefinitions

File

core/lib/Drupal/Core/Entity/EntityFieldManager.php, line 534

Class

EntityFieldManager
Manages the discovery of entity fields.

Namespace

Drupal\Core\Entity

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
public function clearCachedFieldDefinitions() {
  $this->baseFieldDefinitions = [];
  $this->fieldDefinitions = [];
  $this->fieldStorageDefinitions = [];
  $this->fieldMap = [];
  $this->fieldMapByFieldType = [];
  $this->entityDisplayRepository->clearDisplayModeInfo();
  $this->extraFields = [];
  Cache::invalidateTags(['entity_field_info']);
  // The typed data manager statically caches prototype objects with injected
  // definitions, clear those as well.
  $this->typedDataManager->clearCachedDefinitions();
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.