Using Gravity Forms ‘gform_hubspot_form_object_pre_save_feed’ PHP filter

The gform_hubspot_form_object_pre_save_feed Gravity Forms PHP filter allows you to modify the HubSpot form object before saving the feed.

Usage

A generic example of how to use the filter:

add_filter( 'gform_hubspot_form_object_pre_save_feed', 'your_function_name', 10, 3 );

To target a specific form, append the form id to the hook name (format: gform_hubspot_form_object_pre_save_feed_FORMID):

add_filter( 'gform_hubspot_form_object_pre_save_feed_1', 'your_function_name', 10, 3 );

Parameters

  • $hs_form (array): The HubSpot form object to be filtered. See HubSpot’s documentation for more information about what data is used in the array.
  • $feed_meta (array): The meta from the current Feed Object.
  • $form (Form Object): The current form.

More information

See Gravity Forms Docs: gform_hubspot_form_object_pre_save_feed

Examples

Change submit button text

In this example, we will change the submit button text to “Submit the Form”:

add_filter( 'gform_hubspot_form_object_pre_save_feed', 'change_hubspot_feed', 10, 3 );

function change_hubspot_feed( $hs_form, $feed_meta, $form ){
    $hs_form['submitText'] = 'Submit the Form';
    return $hs_form;
}

Place this code in the functions.php file of your active theme. This filter was added in HubSpot version 1.0, and is located in GF_HubSpot::generate_hubspot_form_object() in class-gf-hubspot.php.