gfic_theme
Description
This PHP filter can be used to programmatically set the theme on Image Choices fields
Usage
Applies to all fields.
add_filter( 'gfic_theme', 'set_jetsloth_image_choices_theme', 10, 4 );
Applies to all fields in a specific form. In this case, form id 5.
add_filter( 'gfic_theme_5', 'set_jetsloth_image_choices_theme', 10, 4 );
Applies to specific field and form. In this case, field id 3 in form id 5.
add_filter( 'gfic_theme_5_3', 'set_jetsloth_image_choices_theme', 10, 4 );
Examples
This example sets the Image Choices theme to Polaroid on all standard Radio Buttons fields:
add_filter( 'gfic_theme', 'set_jetsloth_image_choices_theme', 10, 4 );
function set_jetsloth_image_choices_theme($value, $form_id, $field_id, $default_value) {
$field = RGFormsModel::get_field( $form_id, $field_id );
if ( $field->type == "radio" ) {
$value = "polaroid";
}
return $value;
}
Theme Values
Below are all the supported values for the theme option:
form_setting
(default)
Will use the theme defined in the form settings.simple
Will use the Simple theme.polaroid
Will use the Polaroid theme.float-card
Will use the Float Card theme.cover-tile
Will use the Cover Tile theme.porthole
Will use the Porthole theme.circle
Will use the Circle theme.noneb>
Will use not use any theme, leaving the choices unstyled and for you to apply all your own CSS.
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