3 namespace Drupal\Core\Entity;
5 use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
6 use Drupal\Component\Plugin\PluginManagerInterface;
9 * Provides an interface for entity type managers.
11 interface EntityTypeManagerInterface extends PluginManagerInterface, CachedDiscoveryInterface {
14 * Creates a new access control handler instance.
16 * @param string $entity_type
17 * The entity type for this access control handler.
19 * @return \Drupal\Core\Entity\EntityAccessControlHandlerInterface
20 * A access control handler instance.
22 public function getAccessControlHandler($entity_type);
25 * Creates a new storage instance.
27 * @param string $entity_type
28 * The entity type for this storage.
30 * @return \Drupal\Core\Entity\EntityStorageInterface
33 * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
35 public function getStorage($entity_type);
38 * Creates a new view builder instance.
40 * @param string $entity_type
41 * The entity type for this view builder.
43 * @return \Drupal\Core\Entity\EntityViewBuilderInterface
44 * A view builder instance.
46 public function getViewBuilder($entity_type);
49 * Creates a new entity list builder.
51 * @param string $entity_type
52 * The entity type for this list builder.
54 * @return \Drupal\Core\Entity\EntityListBuilderInterface
55 * An entity list builder instance.
57 public function getListBuilder($entity_type);
60 * Creates a new form instance.
62 * @param string $entity_type
63 * The entity type for this form.
64 * @param string $operation
65 * The name of the operation to use, e.g., 'default'.
67 * @return \Drupal\Core\Entity\EntityFormInterface
70 public function getFormObject($entity_type, $operation);
73 * Gets all route provider instances.
75 * @param string $entity_type
76 * The entity type for this route providers.
78 * @return \Drupal\Core\Entity\Routing\EntityRouteProviderInterface[]
80 public function getRouteProviders($entity_type);
83 * Checks whether a certain entity type has a certain handler.
85 * @param string $entity_type
86 * The name of the entity type.
87 * @param string $handler_type
88 * The name of the handler.
91 * Returns TRUE if the entity type has the handler, else FALSE.
93 public function hasHandler($entity_type, $handler_type);
96 * Creates a new handler instance for a entity type and handler type.
98 * @param string $entity_type
99 * The entity type for this handler.
100 * @param string $handler_type
101 * The handler type to create an instance for.
104 * A handler instance.
106 * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
108 public function getHandler($entity_type, $handler_type);
111 * Creates new handler instance.
113 * Usually \Drupal\Core\Entity\EntityManagerInterface::getHandler() is
114 * preferred since that method has additional checking that the class exists
115 * and has static caches.
117 * @param mixed $class
118 * The handler class to instantiate.
119 * @param \Drupal\Core\Entity\EntityTypeInterface $definition
120 * The entity type definition.
123 * A handler instance.
125 public function createHandlerInstance($class, EntityTypeInterface $definition = NULL);
130 * @return \Drupal\Core\Entity\EntityTypeInterface|null
132 public function getDefinition($entity_type_id, $exception_on_invalid = TRUE);
137 * @return \Drupal\Core\Entity\EntityTypeInterface[]
139 public function getDefinitions();