Skip to content

Commit

Permalink
Properly use the filter for interactivity data
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed May 15, 2024
1 parent 72e8846 commit 5543059
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down

0 comments on commit 5543059

Please sign in to comment.