function EntityTestWithRevisionLog::baseFieldDefinitions

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

Overrides RevisionableContentEntityBase::baseFieldDefinitions

1 call to EntityTestWithRevisionLog::baseFieldDefinitions()
EntityTestMulWithRevisionLogPub::baseFieldDefinitions in core/modules/system/tests/modules/entity_test_revlog/src/Entity/EntityTestMulWithRevisionLogPub.php
1 method overrides EntityTestWithRevisionLog::baseFieldDefinitions()
EntityTestMulWithRevisionLogPub::baseFieldDefinitions in core/modules/system/tests/modules/entity_test_revlog/src/Entity/EntityTestMulWithRevisionLogPub.php

File

core/modules/system/tests/modules/entity_test_revlog/src/Entity/EntityTestWithRevisionLog.php, line 37

Class

EntityTestWithRevisionLog
Defines the test entity class.

Namespace

Drupal\entity_test_revlog\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);
    $fields['name'] = BaseFieldDefinition::create('string')->setLabel(t('Name'))
        ->setDescription(t('The name of the test entity.'))
        ->setTranslatable(TRUE)
        ->setRevisionable(TRUE)
        ->setSetting('max_length', 32)
        ->setDisplayOptions('view', [
        'label' => 'hidden',
        'type' => 'string',
        'weight' => -5,
    ])
        ->setDisplayOptions('form', [
        'type' => 'string_textfield',
        'weight' => -5,
    ]);
    return $fields;
}

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