Add Custom Functionality to Submission
Let's create observer function for WebForms that dumps submitted result into XML file.
We will be creating new extension called WebFormsProcessResult.
This file holds information for composer script
This file registers module in Magento system. Without this file the module is not visible.
This file holds basic description of our module. We need to set the sequence so that the module is loaded after the main WebForms extension.
This file registers our event handler function.
Here we define our model of the event observer class. It has some basic members to work with stores, system messages and logging.
$destinationFolder - variable that sets folder where result is being stored. We will be creating files in pub/media/webforms/xml folder.
$filename - is complete path to the file. For example pub/media/webforms/xml/123.xml.
Make sure pub/media folder is writable.
After the module is ready, please run following console commands:
Thats it! Feel free to modify this extension, experiment and add required post processing functionality to WebForms.
You can download sources here.