class EntityTestComposite

Defines the test entity class.

Plugin annotation


@ContentEntityType(
  id = "entity_test_composite",
  label = @Translation("Test entity - composite relationship"),
  base_table = "translatable_entity_test",
  data_table = "translatable_entity_test_data",
  entity_revision_parent_type_field = "parent_type",
  translatable = TRUE,
  content_translation_ui_skip = TRUE,
  handlers = {
    "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
    "view_builder" = "Drupal\entity_test\EntityTestViewBuilder"
  },
  entity_keys = {
    "id" = "id",
    "uuid" = "uuid",
    "bundle" = "type",
    "label" = "name",
    "langcode" = "langcode",
  }
)

Hierarchy

  • class \Drupal\tmgmt_composite_test\Entity\EntityTestComposite extends \Drupal\entity_test\Entity\EntityTestMul

Expanded class hierarchy of EntityTestComposite

File

sources/content/tests/modules/tmgmt_composite_test/src/Entity/EntityTestComposite.php, line 33

Namespace

Drupal\tmgmt_composite_test\Entity
View source
class EntityTestComposite extends EntityTestMul {

  /**
   * {@inheritdoc}
   */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);
    $fields['parent_type'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Parent type'))
      ->setDescription(t('The entity parent type to which this entity is referenced.'));
    return $fields;
  }

}

Members