function field_test_default_value in Drupal 9
Same name and namespace in other branches
- 8 core/modules/field/tests/modules/field_test/field_test.field.inc \field_test_default_value()
- 7 modules/field/tests/field_test.field.inc \field_test_default_value()
Sample 'default value' callback.
1 call to field_test_default_value()
- FieldAttachStorageTest::testFieldAttachSaveEmptyDataDefaultValue in core/
modules/ field/ tests/ src/ Kernel/ FieldAttachStorageTest.php - Tests insert with empty or NULL fields, with default value.
1 string reference to 'field_test_default_value'
- FieldAttachStorageTest::testFieldAttachSaveEmptyDataDefaultValue in core/
modules/ field/ tests/ src/ Kernel/ FieldAttachStorageTest.php - Tests insert with empty or NULL fields, with default value.
File
- core/
modules/ field/ tests/ modules/ field_test/ field_test.field.inc, line 43 - Defines a field type and its formatters and widgets.
Code
function field_test_default_value(FieldableEntityInterface $entity, FieldDefinitionInterface $definition) {
return [
[
'value' => 99,
],
];
}