gform_pre_form_settings_save

Description

Modify the form object before saving on the Form Settings page. 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.

Examples

This example demonstrates how you can 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;
}

Source Code

This filter is located in GFFormSettings::form_settings_ui() in form_settings.php