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.
37 public $group = 'default';
42 * @var \Drupal\Core\Annotation\Translation
44 * @ingroup plugin_translatable
46 public $group_label = '';
51 public function get() {
52 $values = $this->definition;
54 // Use the specified entity type class, and remove it before instantiating.
55 $class = $values['entity_type_class'];
56 unset($values['entity_type_class']);
58 return new $class($values);