$fields = parent::
baseFieldDefinitions($entity_type);
$fields['test_no_display'
] = BaseFieldDefinition::
create('text'
) ->
setLabel(t('Field with no display'
));
$fields['test_display_configurable'
] = BaseFieldDefinition::
create('text'
) ->
setLabel(t('Field with configurable display'
)) ->
setDisplayOptions('view',
[ 'type' => 'text_default',
'weight' => 10,
]) ->
setDisplayConfigurable('view', TRUE
) ->
setDisplayOptions('form',
[ 'type' => 'text_textfield',
'weight' => 10,
]) ->
setDisplayConfigurable('form', TRUE
);
$fields['test_display_non_configurable'
] = BaseFieldDefinition::
create('text'
) ->
setLabel(t('Field with non-configurable display'
)) ->
setDisplayOptions('view',
[ 'type' => 'text_default',
'weight' => 11,
])