Description
Modify the current choice that’s being populated into the current field.
Usage
Apply to all fields on all forms.
add_filter( 'gppa_input_choice', 'my_custom_function' );
Apply to all fields on a specific form.
add_filter( 'gppa_input_choice_FORMID', 'my_custom_function' );
Apply to a specific field on a specific form.
add_filter( 'gppa_input_choice_FORMID_FIELDID', 'my_custom_function' );
Parameters
choice array
The current choice being populated.
field \GF_Field
The current field being populated.
object array
The current object being populated into the current choice.
objects array
An array of objects being populated as choices into the field.
Since
This filter is available since Gravity Forms Populate Anything 1.0-beta-4.116.
Examples
Add a custom choice template to choices
Add a choice template named image
to choices. This pairs well with the gppa_template_rows
JavaScript filter.
add_filter( 'gppa_input_choice', function( $choice, $field, $object, $objects ) {
$choice['image'] = gp_populate_anything()->process_template( $field, 'image', $object, 'choices', $objects );
return $choice;
}, 10, 4 );