Using Gravity Forms ‘gform_hubspot_custom_settings’ PHP filter

The gform_hubspot_custom_settings Gravity Forms PHP filter allows custom settings to be added to the Feed Settings page for custom properties created in HubSpot for certain field types.

Usage

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

Parameters

  • $custom_settings (string): The HTML for the custom settings. Defaults to Lead Status and Lifecycle Stage.
  • $form (Form Object): The current form.

More information

See Gravity Forms Docs: gform_hubspot_custom_settings

Examples

Add a custom property to HubSpot feed settings

This example adds a custom property named “Gravity Forms License Key” to the HubSpot feed settings.

add_filter('gform_hubspot_custom_settings', 'add_hubspot_property', 10, 2);

function add_hubspot_property($custom_settings, $form) {
    $custom_settings['gravity_forms_key_test'] = array(
        'allows_blank' => true,
        'tooltip' => esc_html__('<h6>License Key</h6>Gravity Forms License Key', 'gravityformshubspot')
    );

    return $custom_settings;
}

Add multiple custom properties to HubSpot feed settings

This example adds two custom properties named “Gravity Forms License Key” and “Gravity Forms Support Plan” to the HubSpot feed settings.

add_filter('gform_hubspot_custom_settings', 'add_multiple_hubspot_properties', 10, 2);

function add_multiple_hubspot_properties($custom_settings, $form) {
    $custom_settings['gravity_forms_key_test'] = array(
        'allows_blank' => true,
        'tooltip' => esc_html__('<h6>License Key</h6>Gravity Forms License Key', 'gravityformshubspot')
    );

    $custom_settings['gravity_forms_support_plan'] = array(
        'allows_blank' => true,
        'tooltip' => esc_html__('<h6>Support Plan</h6>Gravity Forms Support Plan', 'gravityformshubspot')
    );

    return $custom_settings;
}

Add a custom property with a default value

This example adds a custom property named “Gravity Forms License Key” with a default value of “Basic”.

add_filter('gform_hubspot_custom_settings', 'add_hubspot_property_with_default', 10, 2);

function add_hubspot_property_with_default($custom_settings, $form) {
    $custom_settings['gravity_forms_key_test'] = array(
        'allows_blank' => true,
        'tooltip' => esc_html__('<h6>License Key</h6>Gravity Forms License Key', 'gravityformshubspot'),
        'default' => 'Basic'
    );

    return $custom_settings;
}

Conditionally add a custom property

This example adds a custom property named “Gravity Forms License Key” only if the form ID is 1.

add_filter('gform_hubspot_custom_settings', 'conditionally_add_hubspot_property', 10, 2);

function conditionally_add_hubspot_property($custom_settings, $form) {
    if ($form['id'] == 1) {
        $custom_settings['gravity_forms_key_test'] = array(
            'allows_blank' => true,
            'tooltip' => esc_html__('<h6>License Key</h6>Gravity Forms License Key', 'gravityformshubspot')
        );
    }

    return $custom
}