function EntityTestDefaultValue::baseFieldDefinitions
Same name in other branches
- 9 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultValue.php \Drupal\entity_test\Entity\EntityTestDefaultValue::baseFieldDefinitions()
- 10 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultValue.php \Drupal\entity_test\Entity\EntityTestDefaultValue::baseFieldDefinitions()
- 11.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultValue.php \Drupal\entity_test\Entity\EntityTestDefaultValue::baseFieldDefinitions()
Overrides EntityTest::baseFieldDefinitions
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Entity/ EntityTestDefaultValue.php, line 28
Class
- EntityTestDefaultValue
- Defines a test entity class for testing default values.
Namespace
Drupal\entity_test\EntityCode
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['description'] = BaseFieldDefinition::create('shape')->setLabel(t('Some custom description'))
->setDefaultValueCallback('entity_test_field_default_value');
return $fields;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.