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 0e350487f9b86..1d31a6935b5fd 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 @@ -131,22 +131,20 @@ public function config( string $store_namespace, array $config = array() ): arra } /** - * Prints the serialized client-side interactivity data. + * Adds interactivity data to filtered data to be passed to the client. * - * Encodes the config and initial state into JSON and prints them inside a - * script tag of type "application/json". Once in the browser, the state will - * be parsed and used to hydrate the client-side interactivity stores and the - * configuration will be available using a `getConfig` utility. + * Once in the browser, the state will be parsed and used to hydrate the client-side + * interactivity stores and the configuration will be available using a `getConfig` utility. * * @since 6.5.0 + * + * @param array $interactivity_data Filtered interactivity data. */ - public function print_client_interactivity_data() { + public function print_client_interactivity_data( $interactivity_data ) { if ( empty( $this->state_data ) && empty( $this->config_data ) ) { - return; + return $interactivity_data; } - $interactivity_data = array(); - $config = array(); foreach ( $this->config_data as $key => $value ) { if ( ! empty( $value ) ) {