Using Gravity Forms ‘gform_field_advanced_settings’ PHP filter

The gform_field_advanced_settings action hook is used to create a new field setting under the Advanced tab in Gravity Forms. This is useful for implementing custom field types that require custom settings.

Usage

add_action('gform_field_advanced_settings', 'my_advanced_settings', 10, 2);

Parameters

  • $position (integer) – Specifies the position where the settings will be displayed. For a list of all available positions, search form_detail.php for “gform_field_advanced_settings” or review the Advanced Field Settings article.
  • $form_id (integer) – The ID of the form from which the entry value was submitted.

More information

See Gravity Forms Docs: gform_field_advanced_settings

Examples

Encrypt Field Value Setting

This example demonstrates how to create a new Advanced setting on position 50 (right after the Admin Label setting) that specifies if the field data should be encrypted. This code sample works in Gravity Forms 2.4, 2.5, and later.

add_action('gform_field_advanced_settings', 'my_advanced_settings', 10, 2);

function my_advanced_settings($position, $form_id) {
    if ($position == 50) {
        ?>
        <li class="encrypt_setting field_setting">
            <input type="checkbox" id="field_encrypt_value" onclick="SetFieldProperty('encryptField', this.checked);" />
            <label for="field_encrypt_value" style="display:inline;">
                <?php _e("Encrypt Field Value", "your_text_domain"); ?>
                <?php gform_tooltip("form_field_encrypt_value") ?>
            </label>
        </li>
        <?php
    }
}

add_action('gform_editor_js', 'editor_script');

function editor_script(){
    ?>
    <script type='text/javascript'>
        fieldSettings.text += ", .encrypt_setting";
        jQuery(document).on("gform_load_field_settings", function(event, field, form){
            jQuery('#field_encrypt_value').prop('checked', Boolean(rgar(field, 'encryptField')));
        });
    </script>
    <?php
}

add_filter('gform_tooltips', 'add_encryption_tooltips');

function add_encryption_tooltips($tooltips) {
    $tooltips['form_field_encrypt_value'] = "<strong>Encryption</strong>Check this box to encrypt this field's data";
    return $tooltips;
}