gppa_no_choices_value

  1. Description
  2. Usage
  3. Parameters
  4. Example
    1. Change the Value of a Choice-based Field When No Result Is Returned
  5. Since

Description

Filter the default choice value for choice-based fields that are dynamically populated but have no available objects based on the current filters.

Usage

Filter the missing filter choice value for all fields.

add_filter( 'gppa_no_choices_value', 'my_custom_function' );

Parameters

  • label string

    Default: (Empty String)

    Choice value.

  • $field GF_Field

    Current field.

Example

Change the Value of a Choice-based Field When No Result Is Returned

add_filter( 'gppa_no_choices_value', function ( $label, $field ) {
// Update 123 to the Form ID and 1 to the Field ID
    if ( $field->formId == 123 and $field->id == 1 ) { 
        $label = 'No Result';
    }
    return $label;
}, 10, 2 );

Since

This filter is available since GP Populate Anything 1.0.