Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@c79c1f7 from refs/heads/release/5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prcdevgitbot committed Feb 22, 2024
1 parent be6130b commit d5e3439
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions includes/interactives/blocks/loader-block/loader-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand All @@ -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'
Expand Down Expand Up @@ -99,4 +101,3 @@ public function block_init() {
);
}
}

0 comments on commit d5e3439

Please sign in to comment.