1. 8.5.x core/lib/Drupal/Core/Entity/EntityType.php
  2. 8.5.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php
  3. 8.0.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php
  4. 8.0.x core/lib/Drupal/Core/Entity/EntityType.php
  5. 8.1.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php
  6. 8.1.x core/lib/Drupal/Core/Entity/EntityType.php
  7. 8.2.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php
  8. 8.2.x core/lib/Drupal/Core/Entity/EntityType.php
  9. 8.3.x core/lib/Drupal/Core/Entity/EntityType.php
  10. 8.3.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php
  11. 8.4.x core/lib/Drupal/Core/Entity/EntityType.php
  12. 8.4.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php
  13. 8.6.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php
  14. 8.6.x core/lib/Drupal/Core/Entity/EntityType.php

Namespace

Drupal\Core\Entity\Annotation

File

core/lib/Drupal/Core/Entity/Annotation/EntityType.php
View source
<?php

namespace Drupal\Core\Entity\Annotation;

use Drupal\Component\Annotation\Plugin;
use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
 * Defines an Entity type annotation object.
 *
 * Entity type plugins use an object-based annotation method, rather than an
 * array-type annotation method (as commonly used on other annotation types).
 * The annotation properties of entity types are found on
 * \Drupal\Core\Entity\EntityType and are accessed using get/set methods defined
 * in \Drupal\Core\Entity\EntityTypeInterface.
 *
 * @ingroup entity_api
 *
 * @Annotation
 */
class EntityType extends Plugin {
  use StringTranslationTrait;

  /**
   * The class used to represent the entity type.
   *
   * It must implement \Drupal\Core\Entity\EntityTypeInterface.
   *
   * @var string
   */
  public $entity_type_class = 'Drupal\\Core\\Entity\\EntityType';

  /**
   * The group machine name.
   *
   * @var string
   */
  public $group = 'default';

  /**
   * The group label.
   *
   * @var \Drupal\Core\Annotation\Translation
   *
   * @ingroup plugin_translatable
   */
  public $group_label = '';

  /**
   * {@inheritdoc}
   */
  public function get() {
    $values = $this->definition;

    // Use the specified entity type class, and remove it before instantiating.
    $class = $values['entity_type_class'];
    unset($values['entity_type_class']);
    return new $class($values);
  }

}

Classes

Namesort descending Description
EntityType Defines an Entity type annotation object.