gravityflow_display_field_choices

Description

The gravityflow_display_field_choices filter allows the Gravity Forms fields to be shown in the Display Fields settings

Parameters

ParameterTypeDetails
$fields_as_choicesArray of FieldsThe Gravity Forms fields to be shown in the Display Fields settings.
$formFormThe form object.
$feedFeed or BooleanThe current feed being processed.
If $feed is false, use the $_POST data.

Examples

Prevent a specific field from being selected

You would also want to combine this example with gravityflow_workflow_detail_display_field for scenarios where the step setting for display was set to show all / hide no fields.

add_filter( 'gravityflow_display_field_choices', 'sh_gravityflow_display_field_choices', 10, 3 );
function sh_gravityflow_display_field_choices( $fields_as_choices, $form, $feed) {
   if ( $form['id'] == '22' ) {
      foreach( $fields_as_choices as $key => $potential_field ) {
         if( $potential_field['id'] == '30' ) {
            unset($fields_as_choices[ $key ]);
         }
      }
   }
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?