bookmark_bordergform_field_standard_settings

Description

Use this action to create new field settings under the Standard tab. Useful when implementing a new custom field type that requires custom settings.

Usage

add_action( 'gform_field_standard_settings', 'my_standard_settings', 10, 2 );

Parameters

  • $index integer

    Specify the position that the settings should be displayed. For a list of all available positions, search form_detail.php for “gform_field_standard_settings” or review the General Field Settings article.

  • $form_id integer

    The ID of the form from which the entry value was submitted.

Examples

This example creates a new Standard setting on position 25 (right after the Field Label setting), that specifies if the field data should be encrypted.

add_action( 'gform_field_standard_settings', 'my_standard_settings', 10, 2 );
function my_standard_settings( $position, $form_id ) {

    //create settings on position 25 (right after Field Label)
    if ( $position == 25 ) {
        ?>
        <li class="encrypt_setting field_setting">
            <label for="field_admin_label">
                <?php esc_html_e( 'Encryption', 'gravityforms' ); ?>
                <?php gform_tooltip( 'form_field_encrypt_value' ) ?>
            </label>
            <input type="checkbox" id="field_encrypt_value" onclick="SetFieldProperty('encryptField', this.checked);" /> encrypt field value
        </li>
        <?php
    }
}

add_action( 'gform_editor_js', 'editor_script' );
function editor_script(){
    ?>
    <script type='text/javascript'>
        //adding setting to fields of type "text"
        fieldSettings.text += ', .encrypt_setting';

        //binding to the load field settings event to initialize the checkbox
        jQuery(document).bind('gform_load_field_settings', function(event, field, form){
            jQuery('#field_encrypt_value').attr('checked', field.encryptField == true);
        });
    </script>
    <?php
}

add_filter( 'gform_tooltips', 'add_encryption_tooltips' );
function add_encryption_tooltips( $tooltips ) {
   $tooltips&#91;'form_field_encrypt_value'&#93; = "<h6>Encryption</h6>Check this box to encrypt this field's data";
   return $tooltips;
}

Source Code

This filter is located in form_detail.php