gform_visibility_options

Description

The “gform_visibility_options” filter in Gravity Forms allows default visibility options to be modified or removed and custom visibility options to be added.

Usage

add_filter( 'gform_visibility_options', 'my_function', 10 );

Parameters

  • $options array

    An array of visibility options.

    • $label string

      The label of the visibility option; displayed in the field’s Visibility setting.

    • $value string

      The value of the visibility option; will be saved to the form meta.

    • $description string

      The description of the visibility option; used in the Visibility setting tooltip.

Examples

add_filter( 'gform_visibility_options', 'my_custom_visibility_options' );
function my_custom_visibility_options( $options ) {
	$options[] = array(
		'label'       => __( 'Custom Option' ),
		'value'       => 'custom',
		'description' => __( 'This is a description of my custom visibility option. It will show up in the Visibility setting tooltip.' )
	);
	return $options;
}

Source Code

return (array) apply_filters( 'gform_visibility_options', $options );

This hook is located in GFCommon::get_visibility_options() in common.php