The gform_pre_form_settings_save Gravity Forms PHP filter allows you to modify the form object before saving it on the Form Settings page. This is useful for saving custom settings added via the gform_form_settings
filter.
Usage
add_filter('gform_pre_form_settings_save', 'your_function_name');
Parameters
- $form (Form Object) – The current form object being edited.
More information
See Gravity Forms Docs: gform_pre_form_settings_save
Examples
Save custom form setting
This example demonstrates how to save custom settings added via the gform_form_settings
filter to the form object using the gform_pre_form_settings_save
filter.
// Add a custom form setting add_filter('gform_form_settings', 'my_custom_form_setting', 10, 2); function my_custom_form_setting($settings, $form) { $settings['Form Basics']['my_custom_setting'] = ' <tr> <th><label for="my_custom_setting">My Custom Label</label></th> <td><input value="' . rgar($form, 'my_custom_setting') . '" name="my_custom_setting"></td> </tr>'; return $settings; } // Save your custom form setting add_filter('gform_pre_form_settings_save', 'save_my_custom_form_setting'); function save_my_custom_form_setting($form) { $form['my_custom_setting'] = rgpost('my_custom_setting'); return $form; }
Additional examples
For additional examples, please refer to the Gravity Forms documentation: gform_pre_form_settings_save