'', 'data-gb-overlay-type' => $overlay_type, 'data-gb-overlay-trigger-type' => $trigger_type, ]; // Conditional data attributes. if ( 'anchored' === $overlay_type && ! empty( $placement ) ) { $data_attributes['data-gb-overlay-placement'] = $placement; } // Position to parent for anchored overlays. if ( 'anchored' === $overlay_type && ! empty( $position_to_parent ) ) { $data_attributes['data-gb-overlay-position-to-parent'] = $position_to_parent; } // Standard overlay specific attributes. if ( 'standard' === $overlay_type ) { // Handle boolean attributes - only add if false (true is default). if ( false === $close_on_esc ) { $data_attributes['data-gb-overlay-close-on-esc'] = 'false'; } if ( false === $close_on_click_outside ) { $data_attributes['data-gb-overlay-close-on-click-outside'] = 'false'; } if ( true === $disable_page_scroll ) { $data_attributes['data-gb-overlay-disable-page-scroll'] = 'true'; } if ( ! empty( $position ) && 'center' !== $position ) { $data_attributes['data-gb-overlay-position'] = $position; } if ( true === $hide_if_cookies_disabled ) { $data_attributes['data-gb-overlay-hide-if-cookies-disabled'] = 'true'; } } $optional_data_attrs = [ 'animation_in' => 'data-gb-overlay-animation-in', 'animation_out' => 'data-gb-overlay-animation-out', 'animation_duration' => 'data-gb-overlay-animation-duration', 'animation_target' => 'data-gb-overlay-animation-target', 'animation_distance' => 'data-gb-overlay-animation-distance', 'hover_buffer' => 'data-gb-overlay-hover-buffer', ]; foreach ( $optional_data_attrs as $var => $attr ) { if ( ! empty( $$var ) ) { $data_attributes[ $attr ] = $$var; } } // Handle special case attributes. if ( 'scroll' === $trigger_type && false !== $scroll_percent && null !== $scroll_percent ) { $data_attributes['data-gb-overlay-scroll-percent'] = $scroll_percent; } if ( 'time' === $trigger_type && false !== $time_delay && null !== $time_delay ) { $data_attributes['data-gb-overlay-time-delay'] = $time_delay; } if ( 'custom' === $trigger_type && ! empty( $custom_event ) ) { $data_attributes['data-gb-overlay-custom-event'] = $custom_event; } if ( 'exit-intent' === $trigger_type || 'time' === $trigger_type || 'scroll' === $trigger_type || 'custom' === $trigger_type ) { if ( false !== $cookie_duration && null !== $cookie_duration ) { $data_attributes['data-gb-overlay-cookie-duration'] = $cookie_duration; } } // Build attributes string. $attributes = []; foreach ( $data_attributes as $key => $value ) { if ( '' === $value ) { $attributes[] = $key; } else { $attributes[] = sprintf( '%s="%s"', $key, esc_attr( $value ) ); } } // Add ARIA attributes. $attributes[] = 'role="dialog"'; $attributes[] = 'aria-modal="true"'; $attributes[] = 'aria-hidden="true"'; $attributes_string = implode( ' ', $attributes ); ?>
>
>