How do I parse twig variables in form fields programmatically?

I’m working on a custom form processing plugin, I want to send a more complex email with a file from the file system attached. My process bit in the form looks like this:

    process:
        -
            emailafile:
                to: '{{ form.value.email }}'
                bcc: ak@netzhexe.de
                subject: 'Exposé von nest-vermittlung.de für das Objekt {{ form.value.objekt }}'
                body: 'Vielen Dank für Ihre Anfrage! Im Anhang finden Sie das angeforderte Exposé. Hier noch einmal die Daten, die Sie uns übermittelt haben: {% include ''forms/data.html.twig'' %}'
        -
            message: 'E-Mail verschickt an {{ form.value.email }}'
        -
            redirect: gesendet

This is from when I was still trying to make this work with the regular email plugin. So now I can get at these parameters in PHP alright, but how do I parse the twig bits? I’ve looked at the way the email plugin does it, but to be honest I don’t really understand it, and simply copying code gives me an error (which I naturally don’t understand either).

Can anybody explain how this works, maybe? I volunteer to put it in the docs then :slight_smile:

1 Like

you cant. see post
you must make the form grammatically with php