3 namespace Drupal\Core\Entity\Annotation;
5 use Drupal\Component\Annotation\Plugin;
6 use Drupal\Core\StringTranslation\StringTranslationTrait;
9 * Defines an Entity type annotation object.
11 * Entity type plugins use an object-based annotation method, rather than an
12 * array-type annotation method (as commonly used on other annotation types).
13 * The annotation properties of entity types are found on
14 * \Drupal\Core\Entity\EntityType and are accessed using get/set methods defined
15 * in \Drupal\Core\Entity\EntityTypeInterface.
21 class EntityType extends Plugin {
23 use StringTranslationTrait;
26 * The class used to represent the entity type.
28 * It must implement \Drupal\Core\Entity\EntityTypeInterface.
32 public $entity_type_class = 'Drupal\Core\Entity\EntityType';
35 * The group machine name.
39 public $group = 'default';
44 * @var \Drupal\Core\Annotation\Translation
46 * @ingroup plugin_translatable
48 public $group_label = '';
53 public function get() {
54 $values = $this->definition;
56 // Use the specified entity type class, and remove it before instantiating.
57 $class = $values['entity_type_class'];
58 unset($values['entity_type_class']);
60 return new $class($values);