Skip to content

gfic_use_lightbox

Description

This PHP filter can be used to programmatically toggle the lightbox feature on Image Choices fields.

Usage

Applies to all fields.

add_filter( 'gfic_use_lightbox', 'toggle_image_choices_lightbox', 10, 4 );

Applies to all fields in a specific form. In this case, form id 5.

add_filter( 'gfic_use_lightbox_5', 'toggle_image_choices_lightbox', 10, 4 );

Applies to specific field and form. In this case, field id 3 in form id 5.

add_filter( 'gfic_use_lightbox_5_3', 'toggle_image_choices_lightbox', 10, 4 );

Parameters

  • $value boolean
    Whether the lightbox feature is enabled or not.
  • $form_id integer
    The current form id.
  • $field_id integer
    The current field id.
  • $default_value boolean
    The plugin’s default value for this option.

Examples

This example enables the lightbox feature on all Image Choices fields

add_filter( 'gfic_use_lightbox_5', 'toggle_image_choices_lightbox', 10, 4 );
function toggle_image_choices_lightbox($value, $form_id, $field_id, $default_value) {
    return true;
}

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