gform_frontend_page_hidden

gform_frontend_page_hidden

DescriptionUsageParametersExamplesLog the parametersPlacementSinceSource Code

Description

The gform_frontend_page_hidden JavaScript action hook is used to perform custom actions when a page step is hidden by conditional logic on the front-end.

Usage

The filter which runs for all would be used like so:

gform.addAction( 'gform_frontend_page_hidden', function( page, formId ) {
//do something
}, 10, 2 );

You can also target a specific form by adding the form id after the hook name.

gform.addAction( 'gform_frontend_page_hidden_6', function( page, formId ) {
//do something
}, 10, 2 );

Parameters

page JavaScript Object
The current page field object.

formId int
The ID of the current form.

Examples

Log the parameters

This example would log the contents of the three parameters to the browser console.

gform.addAction( 'gform_frontend_page_hidden', function( page, formId ) {
console.log( arguments );
}, 10, 2 );

Placement

This code should be placed in a theme custom JS file or a custom JS functions plugin.

Since

This filter was added in Gravity Forms v2.5.

Source Code

This filter is located in GFPageConditionalLogic.hidePage() in page_conditional_logic.js.

gform_freshbooks_args_pre_create

gform_freshbooks_args_pre_create

DescriptionUsageParametersExamples1. Add tax2. Set the line itemsPlacementSource Code

Description
This filter can be used to modify the invoice or estimate object before it is sent to Freshbooks.
Usage
The filter which would run for all Freshbooks feeds can be used like so:
add_filter( 'gform_freshbooks_args_pre_create', 'your_function_name', 10, 4 );

Parameters

$args object
The Freshbooks invoice or estimate object containing the client details, line items, etc.
$args->clientId = '';
$args->number = '';
$args->amount = '';
$args->status = '';
$args->date = '';
$args->poNumber = '';
$args->discount = '';
$args->notes = '';
$args->terms = '';
$args->organization = '';
$args->firstName = '';
$args->lastName = '';
$args->pStreet1 = '';
$args->pStreet2 = '';
$args->pCity = '';
$args->pState = '';
$args->pCountry = '';
$args->pCode = '';
$args->lines = array(
array(
'name' => '',
'description' => '',
'unitCost' => '',
'quantity' => '',
'amount' => '',
),
);

$form Form Object
The Form which is currently being processed.

$entry Entry Object
The Entry which is currently being processed.

$feed Feed Object
The Feed which is currently being processed. Available from v2.2.3.

Examples
1. Add tax
The following example shows how you can add tax to the line items.
add_filter( 'gform_freshbooks_args_pre_create', function ( $args, $form, $entry ) {
$lines = $args->lines;
foreach ( $lines as &$line ) {
$line['tax1Name'] = 'VAT';
$line['tax1Percent'] = 20;
}
$args->lines = $lines;

return $args;
}, 10, 3 );

2. Set the line items
The following example shows how you can set the invoice line items, including how a value can be retrieved from a form field.
add_filter( 'gform_freshbooks_args_pre_create', function ( $args, $form, $entry ) {
$lines = array();

$name = 'The name';
$description = 'The description';
$unit_cost = 10.50;
$quantity = rgar( $entry, '5' ); // get the value from field 5
$amount = $unit_cost * $quantity;

$lines[] = array(
'name' => $name,
'description' => $description,
'unitCost' => $unit_cost,
'quantity' => $quantity,
'amount' => $amount,
);

$args->lines = $lines;

return $args;
}, 10, 3 );

Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFFreshBooks::export_feed() in class-gf-freshbooks.php.

gform_form_trash_link

gform_form_trash_link

DescriptionUsageParametersExamples1. Change the text of the link2. Prevent a specific Form from being deletedPlacementSinceSource Code

Description

This filter is no longer available since Gravity Forms 2.5.

Allows for modification of the Form Trash Link on the Form Editor page.

Note: Replaced the deprecated gform_form_delete_link filter.

Usage

add_filter( 'gform_form_trash_link', 'your_function_name', 10, 2 );

Parameters

$trash_link stringThe Trash link HTML.$form_id intThe ID of the form being edited.

Examples

1. Change the text of the link

add_filter( 'gform_form_trash_link', 'rename_trash_link', 10, 2 );function rename_trash_link( $trash_link, $form_id ){    $trash_link = str_replace( 'Move to Trash', 'Remove this Form', $trash_link );    return $trash_link;}

2. Prevent a specific Form from being deleted

add_filter( 'gform_form_trash_link', 'prevent_form_deletion', 10, 2 );function prevent_form_deletion( $trash_link, $form_id ){    if ( $form_id == 75 ) {        $trash_link = 'Remove this Form';    }    return $trash_link;}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms version 1.8.Added the $form_id param in version 2.1.2.3.

Source Code

This filter is located in GFFormDetail::forms_page() in form_detail.php.

gform_frontend_page_visible

gform_frontend_page_visible

DescriptionUsageParametersExamplesLog the parametersPlacementSinceSource Code

Description

The gform_frontend_page_visible JavaScript action hook is used to perform custom actions when a page step is made visible by conditional logic on the front-end.

Usage

The filter which runs for all would be used like so:

gform.addAction( 'gform_frontend_page_visible', function( page, formId ) {
//do something
}, 10, 2 );

You can also target a specific form by adding the form id after the hook name.

gform.addAction( 'gform_frontend_page_visible_6', function( page, formId ) {
//do something
}, 10, 2 );

Parameters

page JavaScript Object
The current page field object.

formId int
The ID of the current form.

Examples

Log the parameters

This example would log the contents of the three parameters to the browser console.

gform.addAction( 'gform_frontend_page_visible', function( page, formId ) {
console.log( arguments );
}, 10, 2 );

Placement

This code should be placed in a theme custom JS file or a custom JS functions plugin.

Since

This filter was added in Gravity Forms v2.5.

Source Code

This filter is located in GFPageConditionalLogic.showPage() in page_conditional_logic.js.

gform_freshbooks_enable_dynamic_field_mapping

gform_freshbooks_enable_dynamic_field_mapping

DescriptionUsageParametersPlacementSource Code

Description
This filter is used to enable the display of the option for dynamic field mapping under the 『Line Items』 setting on the Freshbooks feed. Dynamic field mapping allows you to map form fields to the line item』s unit cost and quantity.
Usage
1add_filter( 'gform_freshbooks_enable_dynamic_field_mapping', '__return_true' );
Parameters
This hook has no parameters.
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in class-gf-freshbooks.php.

gform_form_update_meta

gform_form_update_meta

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows modifying the form meta before it is saved to the database.
Usage
The following would apply to all forms:
add_filter( 'gform_form_update_meta', 'my_import_form', 10, 3 );

To target a specific form, append the form id to the hook name. (format: gform_form_update_meta_FORMID):
add_filter( 'gform_form_update_meta_1', 'my_import_form', 10, 3 );

Parameters

$form_meta bool
The meta data for the current form.

$form_id int
The current form ID.

$meta_name string
Meta name.

Example
add_filter( 'gform_form_update_meta', 'my_import_form', 10, 3 );
function my_import_form( $meta, $form_id, $meta_name ) {
$is_import_page = GFForms::get_page() == 'import_form';
$is_updating_display_meta = $meta_name == 'display_meta';
if( ! $is_import_page || ! $is_updating_display_meta )
return $meta;
$form = $meta;
$form['isImported'] = true;
return $form;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 1.8.8.
Source Code
This filter is located in GFFormsModel::update_form_meta() in forms_model.php.

gform_frontend_pages_evaluated

gform_frontend_pages_evaluated

DescriptionUsageParametersExamplesLog the parametersPlacementSinceSource Code

Description

The gform_frontend_pages_evaluated JavaScript action hook is used to perform custom actions when page conditional logic rules have been evaulated on the front-end.

Usage

The filter which runs for all would be used like so:

123gform.addAction( 'gform_frontend_pages_evaluated', function( pages, formId, pageLogic ) {    //do something}, 10, 3 );

You can also target a specific form by adding the form id after the hook name.

123gform.addAction( 'gform_frontend_pages_evaluated_6', function( pages, formId, pageLogic ) {    //do something}, 10, 3 );

Parameters

pages array
A collection of page field objects.

formId int
The ID of the current form.

pageLogic JavaScript Object
The currrent GFPageConditionalLogic object.

Examples

Log the parameters

This example would log the contents of the three parameters to the browser console.

123gform.addAction( 'gform_frontend_pages_evaluated', function( pages, formId, pageLogic ) {    console.log( arguments );}, 10, 3 );

Placement

This code should be placed in a theme custom js file or a custom JS functions plugin.

Since

This filter was added in Gravity Forms v2.5.

Source Code

This filter is located in GFPageConditionalLogic.evaluatePages() in page_conditional_logic.js.

gform_form_settings_page_gravityformszapier

gform_form_settings_page_gravityformszapier

Description

Description
The 「gform_form_settings_page_gravityformszapier」 action in the Gravity Forms Zapier Add-On is a hook name that is dynamically generated. The hook gform_form_settings_page_{VIEW} in Gravity Forms is the actual hook that is run. The 「VIEW」 portion of the hook name is replaced with the 「gravityformszapier」 text.
Go to gform_form_settings_page_{VIEW} for details on using this hook.

gform_freshbooks_send_item_id_for_fixed_dynamic

gform_freshbooks_send_item_id_for_fixed_dynamic

DescriptionUsageParametersPlacementSource Code

Description
This filter is used to enable the sending of the Item ID instead of Item Name when using the Fixed Costs or Dynamic Field Mapping settings.
Usage
1add_filter( 'gform_freshbooks_send_item_id_for_fixed_dynamic', '__return_true' );
Parameters
This hook has no parameters.
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in class-gf-freshbooks.php.

gform_form_validation_errors_markup

gform_form_validation_errors_markup

DescriptionUsageParametersExamples1. Basic usagePlacementSinceSource Code

Description
The gform_form_validation_errors_markup filter enables the markup for the validation errors list, which is located at the top of the form, to be overridden.
Usage
add_filter( 'gform_form_validation_errors_markup', 'your_function_name', 10, 2 );

You can also specify this per form by adding the form id after the filter name.
add_filter( 'gform_form_validation_errors_markup_6', 'your_function_name', 10, 2 );

Parameters

$validation_errors_markup string
The HTML for the validation errors list.

$form Form Object
The current form object.

Examples
1. Basic usage
add_filter( 'gform_form_validation_errors_markup', function( $validation_errors_markup, $form ) {
// Do something with the $validation_errors_markup.

return $validation_errors_markup;
}, 10, 2 );

Placement
This code should be placed in the functions.php file of your active theme or a custom functions plugin.
Since
This filter was added in Gravity Forms v2.5.
Source Code
This filter is located in GFFormDisplay::get_validation_errors_markup() in form_display.php.