bookmark_bordergform_form_settings_before_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

<?php
add_filter("gform_form_settings_before_save", "my_custom_function");
?>

Parameters

  • $form

    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_form_settings_before_save filter.

<?php

// add a custom form setting
add_filter('gform_form_settings', 'my_custom_form_setting', 10, 2);
function my_custom_form_setting($settings, $form) {

    $settings&#91;'standard'&#93;&#91;'my_custom_setting'&#93; = '
        <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_form_settings_before_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 form_settings.php