From d5e343967caf063acf8390076ad78d31ea1ba26f Mon Sep 17 00:00:00 2001 From: prcdevgitbot Date: Thu, 22 Feb 2024 19:30:14 +0000 Subject: [PATCH] See https://github.com/pewresearch/pewresearch-org/commit/c79c1f7b540543b609eb84c57fc4eb3c4854dc33 from refs/heads/release/5.0 --- includes/interactives/blocks/loader-block/loader-block.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/interactives/blocks/loader-block/loader-block.php b/includes/interactives/blocks/loader-block/loader-block.php index fba74515..d11306b5 100644 --- a/includes/interactives/blocks/loader-block/loader-block.php +++ b/includes/interactives/blocks/loader-block/loader-block.php @@ -49,7 +49,6 @@ public function render_interactive_loader_callback($attributes, $content, $block // @TODO: Build out the legacy assets S3 loader. } else { $enqueued_handles = $this->load($attributes['slug']); - do_action('qm/debug', print_r($enqueued_handles,true)); } // we need to remove the wpackio stuff when we're loading on the main frontend, that should only load on an iframe... @@ -65,10 +64,13 @@ public function render_interactive_loader_callback($attributes, $content, $block // $enqueued_handles['script']; $script_handle = 'prc-platform-interactive-' . $attributes['slug']; + if ( $is_legacy_wpackio ) { + $script_handle = $enqueued_handles['script']; + } // Use wp_add_inline_script to localize the script instead of wp_localize_script because we want to add the data before the script is enqueued and we want to support multiple localizations for the same script. wp_add_inline_script( $script_handle, - 'if ( typeof prcPlatformInteractives === "undefined" ) { var prcPlatformInteractives = {}; } prcPlatformInteractives["' . $attributes['slug'] . '"] = ' . json_encode(array( + 'if ( typeof prcPlatformInteractives === "undefined" ) { var prcPlatformInteractives = {}; } prcPlatformInteractives = ' . json_encode(array( 'urlVars' => $url_rewrites, )) . ';', 'before' @@ -99,4 +101,3 @@ public function block_init() { ); } } -