The FormMaster plugin offers a variety of hooks and filters allowing developers to customize and extend its functionality. The hooks and filters are interception points in the plugin’s execution flow, where you can add or modify behaviors without directly touching the plugin’s source code.
Hooks
wpformmaster_addhiddenfields
The hook is used to add hidden fields to the form. It is executed at the start of form rendering.
Parameters
Parameter | Type | Description |
---|---|---|
$postID | int | Form ID. |
Use
wpformmaster_addoptinfields
The hook adds optin fields to the form. It is executed at the end of form rendering.
Parameters
Parameter | Type | Description |
---|---|---|
$postID | int | Form ID. |
Use
wpformmaster_insertpost
The hook allows you to perform an action once the form has been sent and validated.
Parameters
Parameter | Type | Description |
---|---|---|
$formID | int | Form ID. |
$spam | bool | true if the form is considered spam. |
$name | string | Contains the name generated from the form results. |
$fields | array | Contains form fields. |
$posts | array | Contains $_POST parameters. |
$files | array | Contains $_FILES parameters. |
Use
Filters
wpformmaster_block_row_allowed_blocks
This filter is used to define the sub-blocks allowed in the “Line” block.
Parameters
Parameter | Type | Description |
---|---|---|
$allowed_blocks | array | Array of authorized blocks. |
Return
Parameter | Type | Description |
---|---|---|
$allowed_blocks | array | Tableau contenant les blocs autorisés. |
Use
wpfmaster_form_validate_field
This filter is used to validate fields when sending the form.
Parameters
Parameter | Type | Description |
---|---|---|
$error | string | Contains reason for error |
$formID | int | Form ID. |
$key | string | Corresponds to the “name” attribute of the field. |
$type | string | Contains the field type. |
$field | array | Contains the various field parameters. |
$errors | array | Contains the list of errors, indexed by the “name” attributes of fields with errors. |
$posts | array | Contains $_POST parameters. |
$files | array | Contains $_FILES parameters. |
Return
Parameter | Type | Description |
---|---|---|
$error | string | Contains reason for error |
Use
wpfmaster_form_validate_additionnals
This filter adds an error message to the form after all fields have been validated.
Parameters
Parameter | Type | Description |
---|---|---|
$errors | array | Contains the list of errors, indexed by the “name” attributes of fields with errors. |
$formID | int | Form ID. |
$posts | array | Contains $_POST parameters. |
$files | array | Contains $_FILES parameters. |
Return
Parameter | Type | Description |
---|---|---|
$errors | array | Contient la liste des erreurs, avec comme index les attributs “name” des champs avec erreur. |
Use
wpfmaster_form_isvalid
This filter is used to define whether or not a form is considered spam.
Parameters
Parameter | Type | Description |
---|---|---|
$valid | bool | true if it’s not spam. |
$postID | int | Form ID. |
$posts | array | Contains $_POST parameters. |
$files | array | Contains $_FILES parameters. |
Return
Parameter | Type | Description |
---|---|---|
$valid | bool | true if it’s not spam. |
Use
wpfmaster_form_mails_counter
This filter lets you modify the number of manageable e-mails in the back office. The default setting is 2.
Parameters
Parameter | Type | Description |
---|---|---|
$counter | int | Number of e-mails |
Return
Parameter | Type | Description |
---|---|---|
$counter | int | Number of e-mails |
Use
wpfmaster_form_messages
This filter is used to add a manageable feedback message.
Parameters
Parameter | Type | Description |
---|---|---|
$messages | array | Array containing messages. |
Return
Parameter | Type | Description |
---|---|---|
$messages | array | Array containing messages. |
Use
wpfmaster_form_extractfields
This filter extracts fields from a form.
Parameters
Parameter | Type | Description |
---|---|---|
$fields | array | Array containing fields. |
$postID | int | Form ID. |
$posts | array | Contains $_POST parameters. |
$files | array | Contains $_FILES parameters. |
Return
Parameter | Type | Description |
---|---|---|
$fields | array | Array containing fields. |
Use
Example for adding a new field: