gfic_enable_images
Description
This PHP filter can be used to programmatically toggle Image Choices on or off on a supported field
Usage
Applies to all fields.
add_filter( 'gfic_enable_images', 'enable_jetsloth_image_choices', 10, 4 );
Applies to all fields in a specific form. In this case, form id 5.
add_filter( 'gfic_enable_images_5', 'enable_jetsloth_image_choices', 10, 4 );
Applies to specific field and form. In this case, field id 3 in form id 5.
add_filter( 'gfic_enable_images_5_3', 'enable_jetsloth_image_choices', 10, 4 );
Examples
This example enables Image Choices for all standard radio button fields:
add_filter( 'gfic_enable_images', 'enable_jetsloth_image_choices', 10, 4 );
function enable_jetsloth_image_choices($value, $form_id, $field_id, $default_value) {
$field = RGFormsModel::get_field( $form_id, $field_id );
if ( $field->type == "radio" ) {
$value = true;
}
return $value;
}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in the get_field_settings_value
function in class-gf-image-choices.php