From 77a6b8ec0fdc8cbe289b039a53dc975e5fd3af86 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Tue, 14 May 2024 17:13:55 +0200 Subject: [PATCH] Use expected core filter name and element ID --- .../interactivity-api/class-wp-interactivity-api.php | 2 +- lib/experimental/script-modules.php | 4 ++-- packages/interactivity/src/store.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/compat/wordpress-6.5/interactivity-api/class-wp-interactivity-api.php b/lib/compat/wordpress-6.5/interactivity-api/class-wp-interactivity-api.php index bcc2634ce7b3a1..34f022f488a582 100644 --- a/lib/compat/wordpress-6.5/interactivity-api/class-wp-interactivity-api.php +++ b/lib/compat/wordpress-6.5/interactivity-api/class-wp-interactivity-api.php @@ -196,7 +196,7 @@ public function register_script_modules() { * @since 6.5.0 */ public function add_hooks() { - add_filter( 'gb_scriptmoduledata_@wordpress/interactivity', array( $this, 'print_client_interactivity_data' ) ); + add_filter( 'scriptmoduledata_@wordpress/interactivity', array( $this, 'print_client_interactivity_data' ) ); } /** diff --git a/lib/experimental/script-modules.php b/lib/experimental/script-modules.php index b17054fd749660..a210f06362d447 100644 --- a/lib/experimental/script-modules.php +++ b/lib/experimental/script-modules.php @@ -215,7 +215,7 @@ function gutenberg_print_script_module_data(): void { } foreach ( array_keys( $modules ) as $module_id ) { - $data = apply_filters( 'gb_scriptmoduledata_' . $module_id, array() ); + $data = apply_filters( 'scriptmoduledata_' . $module_id, array() ); if ( ! empty( $data ) ) { /* * This data will be printed as JSON inside a script tag like this: @@ -264,7 +264,7 @@ function gutenberg_print_script_module_data(): void { wp_json_encode( $data, $json_encode_flags ), array( 'type' => 'application/json', - 'id' => 'gb-scriptmodule-data_' . $module_id, + 'id' => 'wp-scriptmodule-data_' . $module_id, ) ); } diff --git a/packages/interactivity/src/store.ts b/packages/interactivity/src/store.ts index 96a1e970bf568a..ea5ef07a2613eb 100644 --- a/packages/interactivity/src/store.ts +++ b/packages/interactivity/src/store.ts @@ -321,7 +321,7 @@ export function store( export const parseInitialData = ( dom = document ) => { const jsonDataScriptTag = dom.getElementById( - 'gb-scriptmodule-data_@wordpress/interactivity' + 'wp-scriptmodule-data_@wordpress/interactivity' ); if ( jsonDataScriptTag?.textContent ) { try {