Wypo Logo Header@2x
Documentations / Form Master / Hooks and filters

Hooks and filters

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

ParameterTypeDescription
$postIDintForm ID.

Use

PHP

wpformmaster_addoptinfields

The hook adds optin fields to the form. It is executed at the end of form rendering.

Parameters

ParameterTypeDescription
$postIDintForm ID.

Use

PHP

wpformmaster_insertpost

The hook allows you to perform an action once the form has been sent and validated.

Parameters

ParameterTypeDescription
$formIDintForm ID.
$spambooltrue if the form is considered spam.
$namestringContains the name generated from the form results.
$fieldsarrayContains form fields.
$postsarrayContains $_POST parameters.
$filesarrayContains $_FILES parameters.

Use

PHP

Filters

wpformmaster_block_row_allowed_blocks

This filter is used to define the sub-blocks allowed in the “Line” block.

Parameters

ParameterTypeDescription
$allowed_blocksarrayArray of authorized blocks.

Return

ParameterTypeDescription
$allowed_blocksarrayTableau contenant les blocs autorisés.

Use

PHP

wpfmaster_form_validate_field

This filter is used to validate fields when sending the form.

Parameters

ParameterTypeDescription
$errorstringContains reason for error
$formIDintForm ID.
$keystringCorresponds to the “name” attribute of the field.
$typestringContains the field type.
$fieldarrayContains the various field parameters.
$errorsarrayContains the list of errors, indexed by the “name” attributes of fields with errors.
$postsarrayContains $_POST parameters.
$filesarrayContains $_FILES parameters.

Return

ParameterTypeDescription
$errorstringContains reason for error

Use

PHP

wpfmaster_form_validate_additionnals

This filter adds an error message to the form after all fields have been validated.

Parameters

ParameterTypeDescription
$errorsarrayContains the list of errors, indexed by the “name” attributes of fields with errors.
$formIDintForm ID.
$postsarrayContains $_POST parameters.
$filesarrayContains $_FILES parameters.

Return

ParameterTypeDescription
$errorsarrayContient la liste des erreurs, avec comme index les attributs “name” des champs avec erreur.

Use

PHP

wpfmaster_form_isvalid

This filter is used to define whether or not a form is considered spam.

Parameters

ParameterTypeDescription
$valid booltrue if it’s not spam.
$postIDintForm ID.
$postsarrayContains $_POST parameters.
$filesarrayContains $_FILES parameters.

Return

ParameterTypeDescription
$valid booltrue if it’s not spam.

Use

PHP

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

ParameterTypeDescription
$counterintNumber of e-mails

Return

ParameterTypeDescription
$counterintNumber of e-mails

Use

PHP

wpfmaster_form_messages

This filter is used to add a manageable feedback message.

Parameters

ParameterTypeDescription
$messagesarrayArray containing messages.

Return

ParameterTypeDescription
$messagesarrayArray containing messages.

Use

PHP

wpfmaster_form_extractfields

This filter extracts fields from a form.

Parameters

ParameterTypeDescription
$fieldsarrayArray containing fields.
$postIDintForm ID.
$postsarrayContains $_POST parameters.
$filesarrayContains $_FILES parameters.

Return

ParameterTypeDescription
$fieldsarrayArray containing fields.

Use

Example for adding a new field:

PHP