interface EntityTypeRepositoryInterface

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php \Drupal\Core\Entity\EntityTypeRepositoryInterface
  2. 10 core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php \Drupal\Core\Entity\EntityTypeRepositoryInterface
  3. 11.x core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php \Drupal\Core\Entity\EntityTypeRepositoryInterface

Provides an interface for helper methods for loading entity types.

Hierarchy

Expanded class hierarchy of EntityTypeRepositoryInterface

All classes that implement EntityTypeRepositoryInterface

13 files declare their use of EntityTypeRepositoryInterface
ConfigEntityNormalizerTest.php in core/modules/serialization/tests/src/Unit/Normalizer/ConfigEntityNormalizerTest.php
ContentEntityNormalizer.php in core/modules/hal/src/Normalizer/ContentEntityNormalizer.php
ContentEntityNormalizerTest.php in core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
ContentLanguageSettingsUnitTest.php in core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php
EntityFieldManagerTest.php in core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php
Contains \Drupal\Tests\Core\Entity\EntityFieldManagerTest.

... See full list

File

core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php, line 8

Namespace

Drupal\Core\Entity
View source
interface EntityTypeRepositoryInterface {
    
    /**
     * Builds a list of entity type labels suitable for a Form API options list.
     *
     * @param bool $group
     *   (optional) Whether to group entity types by plugin group (e.g. 'content',
     *   'config'). Defaults to FALSE.
     *
     * @return array
     *   An array of entity type labels, keyed by entity type name.
     */
    public function getEntityTypeLabels($group = FALSE);
    
    /**
     * Gets the entity type ID based on the class that is called on.
     *
     * Compares the class this is called on against the known entity classes
     * and returns the entity type ID of a direct match or a subclass as fallback,
     * to support entity type definitions that were altered.
     *
     * @param string $class_name
     *   Class name to use for searching the entity type ID.
     *
     * @return string
     *   The entity type ID.
     *
     * @throws \Drupal\Core\Entity\Exception\AmbiguousEntityClassException
     *   Thrown when multiple subclasses correspond to the called class.
     * @throws \Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException
     *   Thrown when no entity class corresponds to the called class.
     *
     * @see \Drupal\Core\Entity\Entity::load()
     * @see \Drupal\Core\Entity\Entity::loadMultiple()
     */
    public function getEntityTypeFromClass($class_name);
    
    /**
     * Clear the static cache.
     *
     * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
     */
    public function clearCachedDefinitions();

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overrides
EntityTypeRepositoryInterface::clearCachedDefinitions Deprecated public function Clear the static cache. 1
EntityTypeRepositoryInterface::getEntityTypeFromClass public function Gets the entity type ID based on the class that is called on. 2
EntityTypeRepositoryInterface::getEntityTypeLabels public function Builds a list of entity type labels suitable for a Form API options list. 2

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