| 1 |
<?php |
| 2 |
/** |
| 3 |
* Functions to expose the store of the WP_Interactivity_Store class. |
| 4 |
* |
| 5 |
* @package Gutenberg |
| 6 |
* @subpackage Interactivity API |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! function_exists( 'wp_store' ) ) { |
| 10 |
/** |
| 11 |
* Merge data with the existing store. |
| 12 |
* |
| 13 |
* @param array $data Data that will be merged with the existing store. |
| 14 |
* |
| 15 |
* @return $data The current store data. |
| 16 |
*/ |
| 17 |
function wp_store( $data = null ) { |
| 18 |
if ( $data ) { |
| 19 |
WP_Interactivity_Store::merge_data( $data ); |
| 20 |
} |
| 21 |
return WP_Interactivity_Store::get_data(); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Render the Interactivity API store in the frontend. |
| 27 |
*/ |
| 28 |
add_action( 'wp_footer', array( 'WP_Interactivity_Store', 'render' ), 8 ); |
| 29 |
|