I wantMy end goal is to put an inline entity form into another form without using the IEF widget since I'm creating my ownInline Entity Form inside of a custom widget, but I don't want the submit button to submitand have it submittable without submitting the wholeparent form, just the IEF values.. inside of which it has been placed. But
I'm not sure how to do this programmatically. I looked for an example in the tests/ subdirectory ifof IEF, and found a form like this:
$form['inline_entity_form'] = [
'#type' => 'inline_entity_form',
'#entity_type' => 'node',
'#bundle' => 'ief_test_custom',
'#form_mode' => $form_mode,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => t('Save'),
];
But this will submit my form if I puttake this in anothercode and put it inside an existing form via hook_form_alter or a custom widget, it will submit the entire form, when in reality I just want it to save the values for the reference. I also tried to experiment by putting a rendered form into an iframe, but it wouldn't load the form code inside it.
$form = \Drupal::formBuilder()->getForm(\Drupal\user\Form\UserLoginForm::class);
$ief = [
'#type' => 'inline_entity_form',
'#entity_type' => 'node',
'#bundle' => 'article',
'#default_value' => \Drupal\node\Entity\Node::load(1),
'#form_mode' => 'default',
];
$element['inline_entity_form'] = [
'#type' => 'inline_template',
'#template' => '<iframe srcdoc="<div id="iframe-ief">{{ ief|escape }}</div>"></iframe>',
'#context' => [ // Tried the above with & without |escape
'ief' => $form, //<--tried both $form and $ief here.
],
];
Is there any example of doing this that I can look for, or any suggestions or which direction to look?