function EntityTypeManager::getActiveDefinition

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

Gets the active definition for a content entity type.

@internal

Parameters

string $entity_type_id: The entity type ID.

Return value

\Drupal\Core\Entity\EntityTypeInterface The active entity type definition.

File

core/lib/Drupal/Core/Entity/EntityTypeManager.php, line 164

Class

EntityTypeManager
Manages entity type plugin definitions.

Namespace

Drupal\Core\Entity

Code

public function getActiveDefinition($entity_type_id) {
    if (!isset($this->activeDefinitions[$entity_type_id])) {
        $this->activeDefinitions[$entity_type_id] = $this->entityLastInstalledSchemaRepository
            ->getLastInstalledDefinition($entity_type_id);
    }
    return $this->activeDefinitions[$entity_type_id] ?: $this->getDefinition($entity_type_id);
}

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