gpp_popup_config

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Customize the loader markup
    2. Change the iframe sandbox permissions
  5. Since

Description

Filter the popup configuration before it’s passed to the frontend JavaScript. This filter allows modification of the complete popup configuration array that gets serialized as JSON and consumed by the frontend PopupManager. The same config is also available client-side via the gpp_popup_config JS filter (window.gform.addFilter).

Usage

Applied globally

add_filter( 'gpp_popup_config', 'my_custom_function' );

Parameters

$config array

The popup configuration array.

feedId int
formId int
isActive bool
iframeUrl string
ajaxUrl string
loaderHtml string
iframeSandbox string
trigger array
type 'button'|'exit_intent'|'timeout'|'scroll_depth'|'hash'|'js_api'
selector string
delay float
delayUnit 'ms'|'s'
sensitivity int
scrollDepthValue int
scrollDepthUnit 'percent'|'pixels'
hashValue string
display array
displayMode 'popup'|'fullscreen'|'corner'|'banner'
cornerPosition 'bottom_right'|'bottom_left'|'top_right'|'top_left'
bannerPosition 'top'|'bottom'
popupWidth string
popupHeight string
innerWidth string
showBackdrop bool
backdropColor string
backdropBlur bool
animationType 'none'|'fade'|'slide'|'scale'
closeOnBackdropClick bool
closeOnEsc bool
showCloseButton bool
customCssClass string
zIndex int
behavior array
cookieDuration int
cookieName string
respectDismissal bool
autoCloseOnSubmission bool
preloadIframe bool
targeting array

Examples

Customize the loader markup

Replace the default spinner with custom loader HTML.

add_filter( 'gpp_popup_config', function( $config, $feed ) {
    $config['loaderHtml'] = '<div class="contact-form-loader">Loading contact form</div>';
    return $config;
}, 10, 2 );

Change the iframe sandbox permissions

Add additional sandbox tokens to the popup iframe.

add_filter( 'gpp_popup_config', function( $config, $feed ) {
    $config['iframeSandbox'] .= ' allow-popups-to-escape-sandbox';
    return $config;
}, 10, 2 );

Since

  • 1.0.5 Hook added.