3 namespace Drupal\Core\Entity;
6 * Provides an interface for helper methods for loading entity types.
8 interface EntityTypeRepositoryInterface {
11 * Builds a list of entity type labels suitable for a Form API options list.
14 * (optional) Whether to group entity types by plugin group (e.g. 'content',
15 * 'config'). Defaults to FALSE.
18 * An array of entity type labels, keyed by entity type name.
20 public function getEntityTypeLabels($group = FALSE);
23 * Gets the entity type ID based on the class that is called on.
25 * Compares the class this is called on against the known entity classes
26 * and returns the entity type ID of a direct match or a subclass as fallback,
27 * to support entity type definitions that were altered.
29 * @param string $class_name
30 * Class name to use for searching the entity type ID.
35 * @throws \Drupal\Core\Entity\Exception\AmbiguousEntityClassException
36 * Thrown when multiple subclasses correspond to the called class.
37 * @throws \Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException
38 * Thrown when no entity class corresponds to the called class.
40 * @see \Drupal\Core\Entity\Entity::load()
41 * @see \Drupal\Core\Entity\Entity::loadMultiple()
43 public function getEntityTypeFromClass($class_name);
46 * Clear the static cache.
48 * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
50 * @todo Remove in https://www.drupal.org/node/2549143.
52 public function clearCachedDefinitions();