class EntityTestMulRev

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php \Drupal\entity_test\Entity\EntityTestMulRev
  2. 10 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php \Drupal\entity_test\Entity\EntityTestMulRev
  3. 8.9.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php \Drupal\entity_test\Entity\EntityTestMulRev

Defines the test entity class.

Plugin annotation


@ContentEntityType(
  id = "entity_test_mulrev",
  label = @Translation("Test entity - revisions and data table"),
  handlers = {
    "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
    "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
    "form" = {
      "default" = "Drupal\entity_test\EntityTestForm",
      "delete" = "Drupal\entity_test\EntityTestDeleteForm"
    },
    "views_data" = "Drupal\views\EntityViewsData",
    "route_provider" = {
      "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
    },
  },
  base_table = "entity_test_mulrev",
  data_table = "entity_test_mulrev_property_data",
  revision_table = "entity_test_mulrev_revision",
  revision_data_table = "entity_test_mulrev_property_revision",
  admin_permission = "administer entity_test content",
  translatable = TRUE,
  show_revision_ui = TRUE,
  entity_keys = {
    "id" = "id",
    "uuid" = "uuid",
    "bundle" = "type",
    "revision" = "revision_id",
    "label" = "name",
    "langcode" = "langcode",
  },
  links = {
    "add-form" = "/entity_test_mulrev/add",
    "canonical" = "/entity_test_mulrev/manage/{entity_test_mulrev}",
    "delete-form" = "/entity_test/delete/entity_test_mulrev/{entity_test_mulrev}",
    "edit-form" = "/entity_test_mulrev/manage/{entity_test_mulrev}/edit",
    "revision" = "/entity_test_mulrev/{entity_test_mulrev}/revision/{entity_test_mulrev_revision}/view",
  }
)

Hierarchy

Expanded class hierarchy of EntityTestMulRev

18 files declare their use of EntityTestMulRev
ContentEntityCloneTest.php in core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php
ContentEntityNonRevisionableFieldTest.php in core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php
ContentTranslationFieldSyncRevisionTest.php in core/modules/content_translation/tests/src/Kernel/ContentTranslationFieldSyncRevisionTest.php
EntityConverterLatestRevisionTest.php in core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php
EntityDecoupledTranslationRevisionsTest.php in core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php

... See full list

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php, line 50

Namespace

Drupal\entity_test\Entity
View source
class EntityTestMulRev extends EntityTestRev {
  
  /**
   * {@inheritdoc}
   */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);
    $fields['non_mul_field'] = BaseFieldDefinition::create('string')->setLabel(t('Non translatable'))
      ->setDescription(t('A non-translatable string field'))
      ->setRevisionable(TRUE);
    return $fields;
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.