Set entity reference field to 'autocreate' directly in the entity field definitions I'm having trouble with the two ways of defining forms for entities in Drupal (the first one being in the entity field definitions and the second one being by defining a custom form class).

Now, in a classic form, all I have to do is add an element with the  entity_autocomplete type and set #autocreate to array('bundle' =&gt; 'foo'). I tried replicating this in various ways in my entity, none of which worked out (I tried via BaseFieldDefinition's setSetting or in the display options for the form).

What I don't understand is why the two ways of defining forms are so different? Why can't it just be the same syntax in both places?

I'm aware of the Inline Entity Form module, but there doesn't seem to be a proper port for Drupal 8 yet, and what I'm trying to do works perfectly fine when I define the form manually as explained. I just want to be able to define all this in my entity directly to avoid unnecessary code.
I finally found a way to get it to work after digging through the code for the EntityReferenceAutocompleteWidget. To enable automatic creation, I needed to edit the handler settings. Here's my code:

$fields['client'] = BaseFieldDefinition::create('entity_reference')
  -&gt;setLabel(t('Client'))
  -&gt;setSettings(array(
    'target_type'      =&gt; 'client',
    'handler'          =&gt; 'default',
    'handler_settings' =&gt; array(            // Added
      'auto_create'    =&gt; TRUE              // Added
    )
  ))
  -&gt;setDisplayOptions('form', array(
    'type'     =&gt; 'entity_reference_autocomplete',
    'settings' =&gt; array(
      'match_operator' =&gt; 'CONTAINS',
      'size'           =&gt; 60,
      'placeholder'    =&gt; ''
    ),
    'weight'   =&gt; 0
  ))
  -&gt;setRequired(TRUE);