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' => '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.