class EntityTestComputedField extends EntityTest
{ /**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface
$entity_type) { $fields = parent::
baseFieldDefinitions($entity_type);
$fields['computed_string_field'
] = BaseFieldDefinition::
create('string'
) ->
setLabel('Computed Field Test'
) ->
setComputed(TRUE
) ->
setClass(ComputedTestFieldItemList::
class);
$fields['computed_reference_field'
] = BaseFieldDefinition::
create('entity_reference'
) ->
setLabel('Computed Reference Field Test'
) ->
setComputed(TRUE
) ->
setSetting('target_type', 'entity_test'
) ->
setClass(ComputedReferenceTestFieldItemList::
class);
$fields['computed_test_cacheable_string_field'
] = BaseFieldDefinition::
create('computed_test_cacheable_string_item'
) ->
setLabel(new TranslatableMarkup('Computed Cacheable String Field Test'
)) ->
setComputed(TRUE
)