function EntityFieldManager::clearCachedFieldDefinitions

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityFieldManager.php \Drupal\Core\Entity\EntityFieldManager::clearCachedFieldDefinitions()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityFieldManager.php \Drupal\Core\Entity\EntityFieldManager::clearCachedFieldDefinitions()
  3. 11.x core/lib/Drupal/Core/Entity/EntityFieldManager.php \Drupal\Core\Entity\EntityFieldManager::clearCachedFieldDefinitions()

Clears static and persistent field definition caches.

Overrides EntityFieldManagerInterface::clearCachedFieldDefinitions

File

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

Class

EntityFieldManager
Manages the discovery of entity fields.

Namespace

Drupal\Core\Entity

Code

public function clearCachedFieldDefinitions() {
  $this->baseFieldDefinitions = [];
  $this->fieldDefinitions = [];
  $this->fieldStorageDefinitions = [];
  $this->activeFieldStorageDefinitions = [];
  $this->fieldMap = [];
  $this->fieldMapByFieldType = [];
  $this->entityDisplayRepository
    ->clearDisplayModeInfo();
  $this->extraFields = NULL;
  Cache::invalidateTags([
    'entity_field_info',
  ]);
  // The typed data manager statically caches prototype objects with injected
  // definitions, clear those as well.
  $this->typedDataManager
    ->clearCachedDefinitions();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.