How to create a default value for an entity base field in Drupal 8 Both the Examples module and the Drupal Console generate:entity:content both have code like this:

$fields['first_name'] = BaseFieldDefinition::create('string')
  -&gt;setLabel(t('First Name'))
  -&gt;setDescription(t('The first name of the Contact entity.'))
  -&gt;setSettings(array(
    'default_value' =&gt; '',
    'max_length' =&gt; 255,
    'text_processing' =&gt; 0,
  ))


I was thinking that if I provided 'default_value' =&gt; 'Fred' in place of 'default_value' =&gt; '' 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?
The code is outdated, you should create a patch to fix it.

There is a new separate method for the default value, setDefaultValue().