Both the Examples module and the Drupal Console generate:entity:content
both have code like this:
$fields['first_name'] = BaseFieldDefinition::create('string')
->setLabel(t('First Name'))
->setDescription(t('The first name of the Contact entity.'))
->setSettings(array(
'default_value' => '',
'max_length' => 255,
'text_processing' => 0,
))
I was thinking that if I provided 'default_value' => 'Fred'
in place of 'default_value' => ''
that I might affect the default value of the field. I would expect to have seen Fred when creating an entity of this type, and I might have expected to see Fred as the default value in the entity's table definition, but it's not there.
I'm learning D8 and so have two parts to this question really, the first is just how to provide a default value, the second is if this default_value
key isn't it, what is it for?