Using Gravity Forms ‘gform_field_appearance_settings’ PHP action

The gform_field_appearance_settings Gravity Forms action is used to add additional options to the field appearance settings.

Usage

add_action('gform_field_appearance_settings', 'my_function', 10, 2);

Parameters

  • $position (integer): The position where the action is currently firing. Each time the action is called, it will return a different position. For a list of all available positions, search form_detail.php for “gform_field_appearance_settings” or review the Appearance Field Settings article.
  • $form_id (integer): The ID of the form that the action is being run on.

More information

See Gravity Forms Docs: gform_field_appearance_settings

Examples

Adding a custom appearance field

This example adds a custom appearance field to the settings when the position is 50.

function my_custom_appearance_field($position, $form_id) {
    if ($position == 50) {
        // Add your custom appearance field HTML here
    }
}
add_action('gform_field_appearance_settings', 'my_custom_appearance_field', 10, 2);

Adding a CSS class option

This example adds a new CSS class option to the appearance settings when the position is 100.

function my_css_class_option($position, $form_id) {
    if ($position == 100) {
        // Add your CSS class option HTML here
    }
}
add_action('gform_field_appearance_settings', 'my_css_class_option', 10, 2);

Customizing the appearance settings based on form ID

This example customizes the appearance settings based on the form ID.

function my_form_specific_appearance($position, $form_id) {
    if ($form_id == 1 && $position == 75) {
        // Add custom appearance settings for form with ID 1 here
    }
}
add_action('gform_field_appearance_settings', 'my_form_specific_appearance', 10, 2);

Adding multiple appearance options

This example adds multiple appearance options for different positions.

function my_multiple_appearance_options($position, $form_id) {
    if ($position == 200) {
        // Add appearance option for position 200 here
    } elseif ($position == 300) {
        // Add appearance option for position 300 here
    }
}
add_action('gform_field_appearance_settings', 'my_multiple_appearance_options', 10, 2);

Adding a custom tooltip

This example adds a custom tooltip to a new appearance field.

function my_custom_tooltip_appearance_field($position, $form_id) {
    if ($position == 400) {
        // Add your custom appearance field HTML with tooltip here
    }
}
add_action('gform_field_appearance_settings', 'my_custom_tooltip_appearance_field', 10, 2);