I am trying to build a module that provides a widget.
The widget is based on
FileWidget and I would like to add some fields from another form to the existing
I would like to save the content of these fields after submit of the parent form.
So I loaded the form, from which I want to add some elements, in my widgets process method, with
\Drupal::service('entity.form_builder')->getForm($entity) but I am having troubles extracting specific field elements.
If I add a new form element, let's say a textfield, it works as intended and I can access the user input of this field in
hook_entity_presave, but sadly not with elements from an existing form.
In Drupal 7 this could be done with the function
field_attach_form() but this is not possible anymore.
Is there a clean way in Drupal 8 for this?