processFormData
The processFormData
hook is triggered after a form has been submitted. It
passes the form data array, the Data Container Array and the files array as
arguments and does not expect a return value.
Parameters
array
$submittedData
Form data submitted by the visitor.
array
$formData
The form configuration from
tl_form
table.array
$files
Contains information about uploaded files (from “upload” widgets). Can be null.
array
$labels
The field labels of the form.
\Contao\Form
$form
The form instance.
Example
// src/EventListener/ProcessFormDataListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\Form;
#[AsHook('processFormData')]
class ProcessFormDataListener
{
public function __invoke(array $submittedData, array $formData, array|null $files, array $labels, Form $form): void
{
// Do something …
}
}