function contact_storage_test_entity_base_field_info
Same name in other branches
- 9 core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module \contact_storage_test_entity_base_field_info()
- 10 core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module \contact_storage_test_entity_base_field_info()
- 11.x core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module \contact_storage_test_entity_base_field_info()
Implements hook_entity_base_field_info().
File
-
core/
modules/ contact/ tests/ modules/ contact_storage_test/ contact_storage_test.module, line 16
Code
function contact_storage_test_entity_base_field_info(EntityTypeInterface $entity_type) {
if ($entity_type->id() == 'contact_message') {
$fields = [];
$fields['id'] = BaseFieldDefinition::create('integer')->setLabel(t('Message ID'))
->setDescription(t('The message ID.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
return $fields;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.