Description
Allows code to modify the settings fields displayed on a given form settings page.
Usage
Generic: applies to all add-ons and all forms.
add_filter( 'gform_addon_form_settings_fields', 'your_function_name', 10, 2 );
Add-on-specific: applies to a specific add-on for all forms. Requires a minimum PHP version of 5.3.
add_filter( 'gform_{ADDON_SLUG}_form_settings_fields', 'your_function_name', 10, 2 );
See the Gravity Forms Add-On Slugs article for a list of possible slugs.
Parameters
Examples
The example below shows how to set the toggle on the Form Settings > Akismet page to false.
add_filter( 'gform_addon_form_settings_fields', function ( $sections ) {
if ( function_exists( 'gf_akismet' ) && gf_akismet()->is_form_settings( gf_akismet()->get_slug() ) ) {
$sections[0]['fields'][0]['default_value'] = false;
}
return $sections;
} );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
$sections = gf_apply_filters( array( 'gform_addon_form_settings_fields', rgar( $form, 'id' ), $this->_slug ), $sections, $form );
This filter is located in GFAddOn::form_settings_init() in includes/addon/class-gf-addon.php.
Since
This filter was added in Gravity Forms 2.7.