public function EntityFieldManager::getFieldStorageDefinitions in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/EntityFieldManager.php \Drupal\Core\Entity\EntityFieldManager::getFieldStorageDefinitions()
- 9 core/lib/Drupal/Core/Entity/EntityFieldManager.php \Drupal\Core\Entity\EntityFieldManager::getFieldStorageDefinitions()
File
- core/
lib/ Drupal/ Core/ Entity/ EntityFieldManager.php, line 442
Class
- EntityFieldManager
- Manages the discovery of entity fields.
Namespace
Drupal\Core\EntityCode
public function getFieldStorageDefinitions($entity_type_id) {
if (!isset($this->fieldStorageDefinitions[$entity_type_id])) {
$this->fieldStorageDefinitions[$entity_type_id] = [];
// Add all non-computed base fields.
foreach ($this
->getBaseFieldDefinitions($entity_type_id) as $field_name => $definition) {
if (!$definition
->isComputed()) {
$this->fieldStorageDefinitions[$entity_type_id][$field_name] = $definition;
}
}
// Not prepared, try to load from cache.
$cid = 'entity_field_storage_definitions:' . $entity_type_id . ':' . $this->languageManager
->getCurrentLanguage()
->getId();
if ($cache = $this
->cacheGet($cid)) {
$field_storage_definitions = $cache->data;
}
else {
// Rebuild the definitions and put it into the cache.
$field_storage_definitions = $this
->buildFieldStorageDefinitions($entity_type_id);
$this
->cacheSet($cid, $field_storage_definitions, Cache::PERMANENT, [
'entity_types',
'entity_field_info',
]);
}
$this->fieldStorageDefinitions[$entity_type_id] += $field_storage_definitions;
}
return $this->fieldStorageDefinitions[$entity_type_id];
}