The gform_field_standard_settings action creates new field settings under the Standard tab. This is 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
$position
(integer) – Specify the position that the settings should be displayed. For a list of all available positions, searchform_detail.php
for “gform_field_standard_settings” or review the Common 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_standard_settings
This action is located in form_detail.php
.
Examples
Add a setting to encrypt Single Line Text fields
This example creates a new standard setting for Single Line Text fields on the field’s General tab at 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"> <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 } } // Action to inject supporting script to the form editor page 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).on('gform_load_field_settings', function(event, field, form){ jQuery('#field_encrypt_value').prop('checked', Boolean(rgar(field, 'encryptField'))); }); </script> <?php } // Filter to add a new tooltip add_filter('gform_tooltips', 'add_encryption_tooltips'); function add_encryption_tooltips($tooltips) { $tooltips['form_field_encrypt_value'] = "<h6>Encryption</h6>Check this box to encrypt this field's data"; return $tooltips; }