function EntityFieldManager::getFieldStorageDefinitions
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityFieldManager.php \Drupal\Core\Entity\EntityFieldManager::getFieldStorageDefinitions()
- 8.9.x core/lib/Drupal/Core/Entity/EntityFieldManager.php \Drupal\Core\Entity\EntityFieldManager::getFieldStorageDefinitions()
- 11.x core/lib/Drupal/Core/Entity/EntityFieldManager.php \Drupal\Core\Entity\EntityFieldManager::getFieldStorageDefinitions()
1 call to EntityFieldManager::getFieldStorageDefinitions()
- EntityFieldManager::getActiveFieldStorageDefinitions in core/
lib/ Drupal/ Core/ Entity/ EntityFieldManager.php - Gets the active field storage definitions for a content entity type.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityFieldManager.php, line 450
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];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.