Introduction
The GFAPI::update_form()
, GFAPI::update_forms()
, GFAPI::update_form_property()
, and GFAPI::update_forms_property()
methods are used to update forms and their properties.
Updating a single form
The GFAPI::update_form()
method is used to update a single form.
Source Code
public static function update_form( $form , $form_id = null ) {} |
This method is located in /includes/api.php.
Parameters
Param | Type | Description |
---|---|---|
$form | array | An associative array containing the form settings, fields, notifications, confirmations, and other properties (e.g. add-on settings). See Form Object. |
$form_id | null|integer | Optional. The form to be updated, overrides the $form['id'] . |
Returns
Boolean, true on success, or a WP_Error instance if an error occurs.
Usage Example
$result = GFAPI::update_form( $form ); |
Updating multiple forms
The GFAPI::update_forms()
method is used to update multiple forms.
Source Code
public static function update_forms( $forms ) {} |
This method is located in /includes/api.php.
Parameters
Param | Type | Description |
---|---|---|
$forms | array[] | An array containing the forms to be updated. Each form is an associative array containing the form settings, fields, notifications, confirmations, and other properties (e.g. add-on settings). See Form Object. |
Returns
Boolean, true on success, or a WP_Error instance if an error occurs.
Usage Example
$result = GFAPI::update_forms( array ( $form_1 , $form_2 ) ); |
Updating a form property
The GFAPI::update_form_property()
method is used to update a property of a single form.
Source Code
public static function update_form_property( $form_id , $property_key , $value ) {} |
This method is located in /includes/api.php.
Parameters
Param | Type | Description |
---|---|---|
$form_id | integer | The ID of the form the property is to be updated for. |
$property_key | string | The name of the column in the database to be updated. Possible values: is_trash , is_active , or title . |
$value | string|boolean | The new value of the property. |
Returns
The result of the query, mixed, or a WP_Error instance if an error occurs.
Usage Example
$result = GFAPI::update_form_property( $form_id , $property_key , $value ); |
Updating a property for multiple forms
The GFAPI::update_forms_property()
method is used to update a property of multiple forms.
Source Code
public static function update_forms_property( $form_ids , $property_key , $value ) {} |
This method is located in /includes/api.php.
Parameters
Param | Type | Description |
---|---|---|
$form_ids | integer[] | An array of form IDs the property is to be updated for. |
$property_key | string | The name of the column in the database to be updated. Possible values: is_trash , is_active , or title . |
$value | string|boolean | The new value of the property. |
Returns
The result of the query, mixed, or a WP_Error instance if an error occurs.
Usage Example
$result = GFAPI::update_forms_property( array ( $form_1_id , $form_2_id ) ), $property_key , $value ); |