Custom processing in form: Can you give me a more clear example?

Hi guys, I’m a bit confused about how develop my own processing task after the form submission, right now I need send the form’s conten by email using sendgrid, then:

  1. I need register the event ‘onFormProcessed’ but in which descendant class of Plugin must I define this?..for instance in the documentation this event is added inside the EmailPlugin.

Can I add this event inside the Form class?..or must I create my own class??

//could be something like this?
'onFormProcessed' => ['livedrive_handler', 0]
  1. I write the handler for the event…the livedrive_handler

  2. How can I include this in my process chain?..my process would be something like


process:
   - captcha:
            recaptcha_secret: ENTER_YOUR_CAPTCHA_SECRET_KEY
   - save: 
            fileprefix: feedback-
            dateformat: Ymd-His-u
            extension: txt
            body: "{% include 'forms/data.txt.twig' %}"
   - livedrive
   - message: Thank you for your feedback!

how can I achieve something like this?

thanks!

The example in the documentation is taken from the Email plugin. I suggest you to take a look at user/plugins/email/email.php and dissect the implementation of “onFormProcessed”, dropping everything else and creating a sample plugin that implements a similar event, then customize it to provide your own form processing.