{"id":1373,"date":"2024-06-13T09:13:41","date_gmt":"2024-06-13T07:13:41","guid":{"rendered":"https:\/\/wypo.io\/documentations\/%taxomony%\/formmaster\/hooks\/"},"modified":"2024-11-05T08:01:50","modified_gmt":"2024-11-05T07:01:50","slug":"hooks-filters","status":"publish","type":"wypo_documentations","link":"https:\/\/wypo.io\/en\/documentations\/formmaster\/hooks-filters\/","title":{"rendered":"Hooks and filters"},"content":{"rendered":"\n<p class=\"\">The <strong>FormMaster<\/strong> 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&#8217;s execution flow, where you can add or modify behaviors without directly touching the plugin&#8217;s source code.<\/p>\n\n\n\n<div class=\"wp-block-group is-style-smallbordertop  hf_animated fade_bottom default is-layout-constrained wp-block-group-is-layout-constrained\" style=\"margin-top:var(--wp--preset--spacing--50);padding-top:var(--wp--preset--spacing--50)\">\n<h2 class=\"wp-block-heading   \" datalink=\"content-hooks\">Hooks<\/h2>\n\n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" datalink=\"content-wpformmaster_addhiddenfields\">wpformmaster_addhiddenfields<\/h3>\n\n\n\n<p class=\"\">The hook is used to add hidden fields to the form. It is executed at the start of form rendering.<\/p>\n\n\n\n<p class=\"\"><strong>Parameters<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$postID<\/td><td>int<\/td><td>Form ID.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Use<\/strong><\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-846103169\"\n        id=\"codemirror-846103169\"\n      >add_action(&quot;wpformmaster_addhiddenfields&quot;, function ($postID) {\n\t?&gt;\n\t&lt;input type=&quot;hidden&quot; value=&quot;test&quot; name=&quot;_customhiddenfield&quot; \/&gt;\n\t&lt;?php\n}, 11, 1);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-846103169'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            \n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" datalink=\"content-wpformmaster_addoptinfields\">wpformmaster_addoptinfields<\/h3>\n\n\n\n<p class=\"\">The hook adds optin fields to the form. It is executed at the end of form rendering.<\/p>\n\n\n\n<p class=\"\"><strong>Parameters<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$postID<\/td><td>int<\/td><td>Form ID.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Use<\/strong><\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-474753144\"\n        id=\"codemirror-474753144\"\n      >add_action(&quot;wpformmaster_addoptinfields&quot;, function ($postID) {\n  ?&gt;\n  &lt;div class=&quot;formmaster-field&quot; datatype=&quot;radio&quot; dataname=&quot;wpformmaster-option&quot;&gt;\n    &lt;div&gt;\n      &lt;div class=&quot;formmaster-checkbox-row&quot;&gt;\n        &lt;input type=&quot;checkbox&quot; name=&quot;custom-optin&quot; id=&quot;custom-optin&quot; value=&quot;1&quot; required&gt;\n        &lt;label for=&quot;custom-optin&quot;&gt;Custom optin&lt;\/label&gt;\n      &lt;\/div&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n  &lt;?php\n}, 11, 1);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-474753144'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            \n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" datalink=\"content-wpformmaster_insertpost\">wpformmaster_insertpost<\/h3>\n\n\n\n<p class=\"\">The hook allows you to perform an action once the form has been sent and validated.<\/p>\n\n\n\n<p class=\"\"><strong>Parameters<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$formID<\/td><td>int<\/td><td>Form ID.<\/td><\/tr><tr><td>$spam<\/td><td>bool<\/td><td><code>true<\/code> if the form is considered spam.<\/td><\/tr><tr><td>$name<\/td><td>string<\/td><td>Contains the name generated from the form results.<\/td><\/tr><tr><td>$fields<\/td><td>array<\/td><td>Contains form fields.<\/td><\/tr><tr><td>$posts<\/td><td>array<\/td><td>Contains <code>$_POST<\/code> parameters.<\/td><\/tr><tr><td>$files<\/td><td>array<\/td><td>Contains <code>$_FILES<\/code> parameters.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Use<\/strong><\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-197811511\"\n        id=\"codemirror-197811511\"\n      >add_action(&quot;wpformmaster_insertpost&quot;, function ($formID, $spam, $name, $fields, $posts, $files) {\n\tif(!$spam){\n\t\t$counter = get_option(&quot;custom_option_counter&quot;, 0);\n\t\tupdate_option(&quot;custom_option_counter&quot;, $counter+1);\n\t}\n}, 11, 6);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-197811511'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            <\/div>\n\n\n\n<div class=\"wp-block-group is-style-smallbordertop  hf_animated fade_bottom default is-layout-constrained wp-block-group-is-layout-constrained\" style=\"margin-top:var(--wp--preset--spacing--50);padding-top:var(--wp--preset--spacing--50)\">\n<h2 class=\"wp-block-heading   \" datalink=\"content-filters\">Filters<\/h2>\n\n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" datalink=\"content-wpformmaster_block_row_allowed_blocks\">wpformmaster_block_row_allowed_blocks<\/h3>\n\n\n\n<p class=\"\">This filter is used to define the sub-blocks allowed in the \u201cLine\u201d block.<\/p>\n\n\n\n<p class=\"\"><strong>Parameters<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$allowed_blocks<\/td><td>array<\/td><td>Array of authorized blocks.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Return<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$allowed_blocks<\/td><td>array<\/td><td>Tableau contenant les blocs autoris\u00e9s.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Use<\/strong><\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-17300995\"\n        id=\"codemirror-17300995\"\n      >add_filter(&quot;wpformmaster_block_row_allowed_blocks&quot;, function ($allowed_blocks) {\n\tif ($allowed_blocks) {\n\t\t$key = array_search(&#039;core\/paragraph&#039;, $allowed_blocks);\n\t\tif ($key !== false) {\n\t\t\tunset($allowed_blocks&#91;$key&#93;);\n\t\t}\n\t\t$allowed_blocks = array_values($allowed_blocks);\n\t}\n\treturn $allowed_blocks;\n}, 11, 1);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-17300995'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            \n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" datalink=\"content-wpfmaster_form_validate_field\">wpfmaster_form_validate_field<\/h3>\n\n\n\n<p class=\"\">This filter is used to validate fields when sending the form.<\/p>\n\n\n\n<p class=\"\"><strong>Parameters<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$error<\/td><td>string<\/td><td>Contains reason for error<\/td><\/tr><tr><td>$formID<\/td><td>int<\/td><td>Form ID.<\/td><\/tr><tr><td>$key<\/td><td>string<\/td><td>Corresponds to the \u201cname\u201d attribute of the field.<\/td><\/tr><tr><td>$type<\/td><td>string<\/td><td>Contains the field type.<\/td><\/tr><tr><td>$field<\/td><td>array<\/td><td>Contains the various field parameters.<\/td><\/tr><tr><td>$errors<\/td><td>array<\/td><td>Contains the list of errors, indexed by the \u201cname\u201d attributes of fields with errors.<\/td><\/tr><tr><td>$posts<\/td><td>array<\/td><td>Contains <code>$_POST<\/code> parameters.<\/td><\/tr><tr><td>$files<\/td><td>array<\/td><td>Contains <code>$_FILES<\/code> parameters.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Return<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$error<\/td><td>string<\/td><td>Contains reason for error<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Use<\/strong><\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-151983029\"\n        id=\"codemirror-151983029\"\n      >add_filter(&quot;wpfmaster_form_validate_field&quot;, function ($error, $formID, $key, $type, $field, $errors, $posts, $files) {\n\tif (!$error) {\n\t\tif ($key === &quot;your-email&quot;) {\n\t\t\tif (isset($posts&#91;$key&#93;)){\n\t\t\t\tif($posts&#91;$key&#93;!=&quot;custom@info.ch&quot;){\n\t\t\t\t\t$error = &quot;Custom error&quot;;\n        \t\t}\n      \t\t}\n    \t}\n  \t}\n  \treturn $error;\n}, 11, 8);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-151983029'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            \n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" datalink=\"content-wpfmaster_form_validate_additionnals\">wpfmaster_form_validate_additionnals<\/h3>\n\n\n\n<p class=\"\">This filter adds an error message to the form after all fields have been validated.<\/p>\n\n\n\n<p class=\"\"><strong>Parameters<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$errors<\/td><td>array<\/td><td>Contains the list of errors, indexed by the \u201cname\u201d attributes of fields with errors.<\/td><\/tr><tr><td>$formID<\/td><td>int<\/td><td>Form ID.<\/td><\/tr><tr><td>$posts<\/td><td>array<\/td><td>Contains <code>$_POST<\/code> parameters.<\/td><\/tr><tr><td>$files<\/td><td>array<\/td><td>Contains <code>$_FILES<\/code> parameters.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Return<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$errors<\/td><td>array<\/td><td>Contient la liste des erreurs, avec comme index les attributs &#8220;name&#8221; des champs avec erreur.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Use<\/strong><\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-1086269917\"\n        id=\"codemirror-1086269917\"\n      >add_filter(&quot;addAdditionnalsErrors&quot;, function ($errors, $formID, $posts, $files) {\n\tif (!isset($posts&#91;&quot;custom-optin&quot;&#93;) || !$posts&#91;&quot;custom-optin&quot;&#93;) {\n\t\t$errors&#91;&quot;custom-optin&quot;&#93; = &quot;Invalid custom&quot;;\n\t}\n\treturn $errors;\n}, 11, 4);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-1086269917'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            \n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" datalink=\"content-wpfmaster_form_isvalid\">wpfmaster_form_isvalid<\/h3>\n\n\n\n<p class=\"\">This filter is used to define whether or not a form is considered spam.<\/p>\n\n\n\n<p class=\"\"><strong>Parameters<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$valid <\/td><td>bool<\/td><td><code>true<\/code> if it&#8217;s not spam.<\/td><\/tr><tr><td>$postID<\/td><td>int<\/td><td>Form ID.<\/td><\/tr><tr><td>$posts<\/td><td>array<\/td><td>Contains <code>$_POST<\/code> parameters.<\/td><\/tr><tr><td>$files<\/td><td>array<\/td><td>Contains <code>$_FILES<\/code> parameters.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Return<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$valid <\/td><td>bool<\/td><td><code>true<\/code> if it&#8217;s not spam.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Use<\/strong><\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-1005889893\"\n        id=\"codemirror-1005889893\"\n      >add_filter(&quot;wpfmaster_form_isvalid&quot;, function ($valid, $formID, $posts, $files) {\n\tif ($valid) {\n        $value = isset( $posts&#91;&quot;custom-honeypot&quot;&#93; ) ? $posts&#91;&quot;custom-honeypot&quot;&#93; : &#039;&#039;;\n\t\treturn $value==&quot;&quot;;\n\t}\n    return $valid;\n}, 10, 4);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-1005889893'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            \n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" id=\"content-wpfmaster_form_mails_counter\" datalink=\"content-wpfmaster_form_mails_counter\">wpfmaster_form_mails_counter<\/h3>\n\n\n\n<p class=\"\">This filter lets you modify the number of manageable e-mails in the back office. The default setting is 2.<\/p>\n\n\n\n<p class=\"\"><strong>Parameters<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$counter<\/td><td>int<\/td><td>Number of e-mails<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Return<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$counter<\/td><td>int<\/td><td>Number of e-mails<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Use<\/strong><\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-1244089699\"\n        id=\"codemirror-1244089699\"\n      >add_filter(&quot;wpfmaster_form_mails_counter&quot;, function ($counter) {\n\treturn 3;\n}, 11, 1);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-1244089699'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            \n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" datalink=\"content-wpfmaster_form_messages\">wpfmaster_form_messages<\/h3>\n\n\n\n<p class=\"\">This filter is used to add a manageable feedback message.<\/p>\n\n\n\n<p class=\"\"><strong><strong>Parameters<\/strong><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$messages<\/td><td>array<\/td><td>Array containing messages.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Return<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$messages<\/td><td>array<\/td><td>Array containing messages.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Use<\/strong><\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-544183806\"\n        id=\"codemirror-544183806\"\n      >add_filter(&quot;wpfmaster_form_messages&quot;, function ($messages) {\n    if (!isset($messages&#91;&quot;test&quot;&#93;)) {\n        $messages&#91;&quot;test&quot;&#93; = &#91;&quot;label&quot; =&gt; &quot;Test&quot;, &quot;default&quot; =&gt; &quot;Default value&quot;&#93;;\n    }\n    return $messages;\n}, 11, 1);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-544183806'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            \n\n            <div class=\"wp-block-habefast-advanced-layout-group is-layout-constrained wp-block-habefast-advanced-layout-group-is-layout-constrained\">\r\n                <div class=\"wp-block-habefast-advanced-group-container is-style- is-layout-constrained\"  style='--_hfal-cg-d-lg:flex;--_hfal-cg-d-md:flex;--_hfal-cg-d-sm:flex;'>\r\n                                        <div class=\"wp-block-habefast-advanced-group-inner is-layout-flow\">\r\n                        \n\n<h3 class=\"wp-block-heading   \" datalink=\"content-wpfmaster_form_extractfields\">wpfmaster_form_extractfields<\/h3>\n\n\n\n<p class=\"\">This filter extracts fields from a form.<\/p>\n\n\n\n<p class=\"\"><strong>Parameters<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$fields<\/td><td>array<\/td><td>Array containing fields.<\/td><\/tr><tr><td>$postID<\/td><td>int<\/td><td>Form ID.<\/td><\/tr><tr><td>$posts<\/td><td>array<\/td><td>Contains <code>$_POST<\/code> parameters.<\/td><\/tr><tr><td>$files<\/td><td>array<\/td><td>Contains <code>$_FILES<\/code> parameters.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong>Return<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table  \"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>$fields<\/td><td>array<\/td><td>Array containing fields.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\"><strong><strong>Use<\/strong><\/strong><\/p>\n\n\n\n<p class=\"\">Example for adding a new field:<\/p>\n\n\n    <div class=\"wp-block-habefast-code  \">\n      <header class=\"habefast-code-header\">\n        <div class=\"habefast-code-lang is-lang-php\">\n          PHP        <\/div>\n      <\/header>\n      <textarea\n        class=\"habefast-code-source\"\n        name=\"codemirror-1735286426\"\n        id=\"codemirror-1735286426\"\n      >add_filter(&quot;wpfmaster_form_extractfields&quot;, function ($fields, $postID, $posts, $files) {\n    return array_merge($fields, &#91;\n\t\t&#91;\n\t\t\t&quot;attrs&quot; =&gt; &#91;\n\t\t\t\t&quot;type&quot; =&gt; &quot;select-opticien&quot;,\n\t\t\t\t&quot;name&quot; =&gt; &quot;choice-select-opticien&quot;\n\t\t\t&#93;\n\t\t&#93;\n\t&#93;);\n}, 11, 4);<\/textarea>\n      <script>\n        CodeMirror.fromTextArea( document.getElementById('codemirror-1735286426'), {\n          mode: {name:'php',startOpen:true},\n          readOnly: true,\n          lineNumbers: true,\n          firstLineNumber: 1,\n          matchBrackets: true,\n          indentUnit: 4,\n          tabSize: 4,\n          lineWrapping: true,\n        } );\n      <\/script>\n    <\/div>\n    \n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n            <\/div>\n","protected":false},"featured_media":0,"parent":1366,"menu_order":16,"template":"","meta":{"_habefastfse_class":"","hf_wpseo_meta_title":"Hooks and filters in the FormMaster plugin [separator] [sitetitle]","hf_wpseo_meta_description":"Explore the complete documentation of the FormMaster plugin hooks and filters. Learn how to extend and customize FormMaster's functionality using the available hooks and filters.","hf_wpseo_meta_robots_index":"","hf_wpseo_meta_robots_follow":true,"hf_wpseo_meta_robots_advanced":"{}","hf_wpseo_meta_canonical_url":"","documentation_description":"","documentation_menu_text":"","documentation_related_pageid":0,"wypo_hidden_role_wypo_users_not_logged":false,"wypo_visibility_role_wypo_users_not_logged":false,"wypo_hidden_role_administrator":false,"wypo_visibility_role_administrator":false,"wypo_hidden_role_habefast":false,"wypo_visibility_role_habefast":false,"wypo_hidden_role_customer":false,"wypo_visibility_role_customer":false,"wypo_hidden_role_habefast_manager":false,"wypo_visibility_role_habefast_manager":false,"wypo_hidden_for_role":false,"wypo_visibility_for_role":false},"class_list":["post-1373","wypo_documentations","type-wypo_documentations","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/wypo.io\/en\/wp-json\/wp\/v2\/wypo_documentations\/1373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wypo.io\/en\/wp-json\/wp\/v2\/wypo_documentations"}],"about":[{"href":"https:\/\/wypo.io\/en\/wp-json\/wp\/v2\/types\/wypo_documentations"}],"up":[{"embeddable":true,"href":"https:\/\/wypo.io\/en\/wp-json\/wp\/v2\/wypo_documentations\/1366"}],"wp:attachment":[{"href":"https:\/\/wypo.io\/en\/wp-json\/wp\/v2\/media?parent=1373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}