function EntityFieldManager::getBaseFieldDefinitions

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

Overrides EntityFieldManagerInterface::getBaseFieldDefinitions

3 calls to EntityFieldManager::getBaseFieldDefinitions()
EntityFieldManager::getFieldDefinitions in core/lib/Drupal/Core/Entity/EntityFieldManager.php
Gets the field definitions for a specific bundle.
EntityFieldManager::getFieldMap in core/lib/Drupal/Core/Entity/EntityFieldManager.php
Gets a lightweight map of fields across bundles.
EntityFieldManager::getFieldStorageDefinitions in core/lib/Drupal/Core/Entity/EntityFieldManager.php
Gets the field storage definitions for a content entity type.

File

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

Class

EntityFieldManager
Manages the discovery of entity fields.

Namespace

Drupal\Core\Entity

Code

public function getBaseFieldDefinitions($entity_type_id) {
    // Check the static cache.
    if (!isset($this->baseFieldDefinitions[$entity_type_id])) {
        // Not prepared, try to load from cache.
        $cid = 'entity_base_field_definitions:' . $entity_type_id . ':' . $this->languageManager
            ->getCurrentLanguage()
            ->getId();
        if ($cache = $this->cacheGet($cid)) {
            $this->baseFieldDefinitions[$entity_type_id] = $cache->data;
        }
        else {
            // Rebuild the definitions and put it into the cache.
            $this->baseFieldDefinitions[$entity_type_id] = $this->buildBaseFieldDefinitions($entity_type_id);
            $this->cacheSet($cid, $this->baseFieldDefinitions[$entity_type_id], Cache::PERMANENT, [
                'entity_types',
                'entity_field_info',
            ]);
        }
    }
    return $this->baseFieldDefinitions[$entity_type_id];
}

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