function entity_test_entity_base_field_info in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_base_field_info()
Implements hook_entity_base_field_info().
File
- core/
modules/ system/ tests/ modules/ entity_test/ entity_test.module, line 105 - Test module for the entity API providing several entity types for testing.
Code
function entity_test_entity_base_field_info(EntityTypeInterface $entity_type) {
$fields = [];
if ($entity_type
->id() == 'entity_test_mulrev' && \Drupal::state()
->get('entity_test.field_test_item')) {
$fields['field_test_item'] = BaseFieldDefinition::create('field_test')
->setLabel(t('Field test'))
->setDescription(t('A field test.'))
->setRevisionable(TRUE)
->setTranslatable(TRUE);
}
return $fields;
}