function EntityTestRev::baseFieldDefinitions

Same name in other branches
  1. 9 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php \Drupal\entity_test\Entity\EntityTestRev::baseFieldDefinitions()
  2. 8.9.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php \Drupal\entity_test\Entity\EntityTestRev::baseFieldDefinitions()
  3. 10 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php \Drupal\entity_test\Entity\EntityTestRev::baseFieldDefinitions()

Overrides EntityTest::baseFieldDefinitions

2 calls to EntityTestRev::baseFieldDefinitions()
EntityTestMulRev::baseFieldDefinitions in core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php
EntityTestRevPub::baseFieldDefinitions in core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRevPub.php
2 methods override EntityTestRev::baseFieldDefinitions()
EntityTestMulRev::baseFieldDefinitions in core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php
EntityTestRevPub::baseFieldDefinitions in core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRevPub.php

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php, line 62

Class

EntityTestRev
Defines the test entity class.

Namespace

Drupal\entity_test\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);
    $fields['name']->setRevisionable(TRUE);
    $fields['user_id']->setRevisionable(TRUE);
    $fields['non_rev_field'] = BaseFieldDefinition::create('string')->setLabel(t('Non Revisionable Field'))
        ->setDescription(t('A non-revisionable test field.'))
        ->setRevisionable(FALSE)
        ->setTranslatable(TRUE)
        ->setCardinality(1)
        ->setReadOnly(TRUE);
    return $fields;
}

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