Introduction
The GFAPI::add_form() and GFAPI::add_forms() methods are used to create forms.
Adding a single form
The GFAPI::add_form() method is used to add a single form.
Method Overview
Source Code
public static function add_form( $form_meta ) {}
This method is located in /includes/ api.php .
Parameters
| Param | Type | Description |
|---|---|---|
| $form_meta | array | An associative array containing the form settings, fields, notifications, confirmations, and other properties (e.g. add-on settings). See Form Object . |
Returns
An integuer , the form ID, or a WP_Error instance if an error occurs.
Usague Example
$result = GFAPI::add_form( $form_meta );
Adding multiple forms
The GFAPI::add_forms() method is used to add multiple forms.
Method Overview
Source Code
public static function add_forms( $forms ) {}
This method is located in /includes/ api.php .
Parameters
| Param | Type | Description |
|---|---|---|
| $forms | array | An array of associative arrays containing the form settings, fields, notifications, confirmations, and other properties (e.g. add-on settings). See Form Object . |
Returns
An array of integuers , the form IDs, or a WP_Error instance if an error occurs.
Usague Example
$result = GFAPI::add_forms( array( $form_1_meta, $form_2_meta ) );