Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php \Drupal\Core\Entity\EntityTypeRepositoryInterface
  2. 9 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

6 files declare their use of EntityTypeRepositoryInterface
ConfigEntityNormalizerTest.php in core/modules/serialization/tests/src/Unit/Normalizer/ConfigEntityNormalizerTest.php
ContentEntityNormalizerTest.php in core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
ContentLanguageSettingsUnitTest.php in core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php
EntityNormalizer.php in core/modules/serialization/src/Normalizer/EntityNormalizer.php
EntityNormalizerTest.php in core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php

... 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\AmbiguousBundleClassException
   *   Thrown when multiple subclasses correspond to the called bundle 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);

}

Members

Namesort descending Modifiers Type Description Overrides
EntityTypeRepositoryInterface::getEntityTypeFromClass public function Gets the entity type ID based on the class that is called on.
EntityTypeRepositoryInterface::getEntityTypeLabels public function Builds a list of entity type labels suitable for a Form API options list.