Skip to content

gfic_lightbox_options

Description

This Javascript filter can be used to set or override options for the Image Choices lightbox feature

Usage

Applies to all fields.

gform.addFilter( 'gfic_lightbox_options', function( options, formId, fieldId ){
    return options;
}, 10, 3);

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

gform.addFilter( 'gfic_lightbox_options_5', function( options, formId, fieldId ){
    return options;
}, 10, 3);

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

gform.addFilter( 'gfic_lightbox_options_5_3', function( options, formId, fieldId ){
    return options;
}, 10, 3);

Parameters

  • options Object
    Current options object.
  • formId Number
    The current form id.
  • fieldId Number
    The current field id.

Examples

This example disables next/previous navigation in the lightbox for Image Choices by hiding the nav buttons and disabling swipe and keyboard controls:

gform.addFilter( 'gfic_lightbox_options', function( options, formId, fieldId ){
    options.nav = false;
    options.enableKeyboard = false;
    options.enableSwipe = false;
    return options;
}, 10, 3);

Placement

Your code snippet can be placed in a HTML field on your form (within <script></script> tags), or in a theme custom JavaScript file, or you could use the free Gravity Forms Code Chest addon by our friends at GravityWiz.

Source Code

This filter is located in the imageChoices.InitLightbox function in js/gf_image_choices.js.