public EntityFieldManager::getBaseFieldDefinitions($entity_type_id)
Gets the base field definitions for a content entity type.
Only fields that are not specific to a given bundle or set of bundles are returned. This excludes configurable fields, as they are always attached to a specific bundle.
Parameters
string $entity_type_id: The entity type ID. Only entity types that implement \Drupal\Core\Entity\FieldableEntityInterface are supported.
Return value
\Drupal\Core\Field\FieldDefinitionInterface[] The array of base field definitions for the entity type, keyed by field name.
Throws
\LogicException Thrown if one of the entity keys is flagged as translatable.
Overrides EntityFieldManagerInterface::getBaseFieldDefinitions
File
- core/lib/Drupal/Core/Entity/EntityFieldManager.php, line 161
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]; }
Please login to continue.