Form API¶
Form submissions¶
To manage form submissions created in the Form Builder, use FormSubmissionServiceInterface.
Restricting access to form submissions
By default, back office users with access to the form content item can access the form submissions.
If your form submissions require stricter access control than the form itself, you can introduce a dedicated policy that manages access to submission data.
Getting form submissions¶
To get existing form submissions, use FormSubmissionServiceInterface::loadByContent() (which takes a ContentInfo object as parameter), or FormSubmissionServiceInterface::loadById().
1 | |
Through this object, you can get information about submissions, such as their total number, and submission contents.
1 2 3 4 5 6 7 8 9 | |
Creating form submissions¶
To create a form submission, use the FormSubmissionServiceInterface::create() method.
This method takes:
- the
ContentInfoobject of the content item containing the form - the language code
- the value of the field containing the form
- the array of form field values
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Deleting form submissions¶
You can delete a form submission by using the FormSubmissionServiceInterface::delete() method.
1 2 | |