Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / Entity / EntityTypeManagerInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity;
4
5 use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
6 use Drupal\Component\Plugin\PluginManagerInterface;
7
8 /**
9  * Provides an interface for entity type managers.
10  */
11 interface EntityTypeManagerInterface extends PluginManagerInterface, CachedDiscoveryInterface {
12
13   /**
14    * Creates a new access control handler instance.
15    *
16    * @param string $entity_type
17    *   The entity type for this access control handler.
18    *
19    * @return \Drupal\Core\Entity\EntityAccessControlHandlerInterface
20    *   A access control handler instance.
21    */
22   public function getAccessControlHandler($entity_type);
23
24   /**
25    * Creates a new storage instance.
26    *
27    * @param string $entity_type
28    *   The entity type for this storage.
29    *
30    * @return \Drupal\Core\Entity\EntityStorageInterface
31    *   A storage instance.
32    *
33    * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
34    */
35   public function getStorage($entity_type);
36
37   /**
38    * Creates a new view builder instance.
39    *
40    * @param string $entity_type
41    *   The entity type for this view builder.
42    *
43    * @return \Drupal\Core\Entity\EntityViewBuilderInterface
44    *   A view builder instance.
45    */
46   public function getViewBuilder($entity_type);
47
48   /**
49    * Creates a new entity list builder.
50    *
51    * @param string $entity_type
52    *   The entity type for this list builder.
53    *
54    * @return \Drupal\Core\Entity\EntityListBuilderInterface
55    *   An entity list builder instance.
56    */
57   public function getListBuilder($entity_type);
58
59   /**
60    * Creates a new form instance.
61    *
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'.
66    *
67    * @return \Drupal\Core\Entity\EntityFormInterface
68    *   A form instance.
69    */
70   public function getFormObject($entity_type, $operation);
71
72   /**
73    * Gets all route provider instances.
74    *
75    * @param string $entity_type
76    *   The entity type for this route providers.
77    *
78    * @return \Drupal\Core\Entity\Routing\EntityRouteProviderInterface[]
79    */
80   public function getRouteProviders($entity_type);
81
82   /**
83    * Checks whether a certain entity type has a certain handler.
84    *
85    * @param string $entity_type
86    *   The name of the entity type.
87    * @param string $handler_type
88    *   The name of the handler.
89    *
90    * @return bool
91    *   Returns TRUE if the entity type has the handler, else FALSE.
92    */
93   public function hasHandler($entity_type, $handler_type);
94
95   /**
96    * Returns a handler instance for the given entity type and handler.
97    *
98    * Entity handlers are instantiated once per entity type and then cached
99    * in the entity type manager, and so subsequent calls to getHandler() for
100    * a particular entity type and handler type will return the same object.
101    * This means that properties on a handler may be used as a static cache,
102    * although as the handler is common to all entities of the same type,
103    * any data that is per-entity should be keyed by the entity ID.
104    *
105    * @param string $entity_type
106    *   The entity type for this handler.
107    * @param string $handler_type
108    *   The handler type to create an instance for.
109    *
110    * @return object
111    *   A handler instance.
112    *
113    * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
114    */
115   public function getHandler($entity_type, $handler_type);
116
117   /**
118    * Creates new handler instance.
119    *
120    * Usually \Drupal\Core\Entity\EntityManagerInterface::getHandler() is
121    * preferred since that method has additional checking that the class exists
122    * and has static caches.
123    *
124    * @param mixed $class
125    *   The handler class to instantiate.
126    * @param \Drupal\Core\Entity\EntityTypeInterface $definition
127    *   The entity type definition.
128    *
129    * @return object
130    *   A handler instance.
131    */
132   public function createHandlerInstance($class, EntityTypeInterface $definition = NULL);
133
134   /**
135    * {@inheritdoc}
136    *
137    * @return \Drupal\Core\Entity\EntityTypeInterface|null
138    */
139   public function getDefinition($entity_type_id, $exception_on_invalid = TRUE);
140
141   /**
142    * {@inheritdoc}
143    *
144    * @return \Drupal\Core\Entity\EntityTypeInterface[]
145    */
146   public function getDefinitions();
147
148 }