Suppose, I've two entities:
entityA
entityB
A user creates an entityA
and has the option of creating multiple types of entityB
referenced from a single entityA
. For example, a parent-child relationship. Parent being entityA
and child being entityB
.
In the module, I want the users to select an entityA
object, go to a new page page for creating entityB
. So, at this point, (add-form of entityB
) I should have the data of that particular entityA
object that the user clicked on.
So, far I'm able to get "all" the data of entityA
on the add-form of entityB
, which is of no help as I'm unable to get the specific id
of entityA
.
The relevant code are:
routing.yml
mymodule.entityB_add:
path: '/admin/config/mymodule/{entityA}/entityB/add'
defaults:
_entity_form: 'mymodule_entityA_entityB.default'
_title: 'EntityB'
requirements:
_entity_create_access: 'mymodule_entityA'
When, I'm shown the form addition page of entityB
(type: ../../testentitya/entityA/add
), how do I pass the entityA
object to the form and what will be the structure of entityB's config schema?