I've been given a requirement to allow for a webform to be inserted into another webform's confirmation page.
At first I tried this with a token I could insert into the confirmation message, the form appears fine, but of course, the new webform is inside of the "parent" webform, which strips out the form tag.
So now I have overriden a few of the webform and webform submission entities handlers, so I can write my own custom getCustomForm function, I can get the new form appearing, but the submit behaviours are weird.
I've tried many things including:
return Webform::load(
$webform->getThirdPartySetting('my_module', 'webform')
)->getSubmissionForm();
and
$form['confirmation'] = [
'#type' => 'webform',
'#webform' => $webform->getThirdPartySetting('wwf_fields', 'webform'),
'#source_entity' => $webform,
'#message' => [
'#type' => 'inline_template',
'#template' => $webform->getSetting('confirmation_message')
]
];
Is there some combination of code I'm missing, or am I trying to bend the system a little too much?
Thanks!