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.
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 integer, the form ID, or a WP_Error instance if an error occurs.
Usage Example
$result = GFAPI::add_form( $form_meta );
Adding multiple forms
The GFAPI::add_forms()
method is used to add multiple forms.
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 integers, the form IDs, or a WP_Error instance if an error occurs.
Usage Example
$result = GFAPI::add_forms( array( $form_1_meta, $form_2_meta ) );