| 1 |
<?php |
| 2 |
/** |
| 3 |
* Interactivity API functions specific for the Gutenberg editor plugin. |
| 4 |
* |
| 5 |
* @package gutenberg |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Deregisters the Core Interactivity API Modules and replace them |
| 10 |
* with the ones from the Gutenberg plugin. |
| 11 |
*/ |
| 12 |
function gutenberg_reregister_interactivity_script_modules() { |
| 13 |
$default_version = defined( 'GUTENBERG_VERSION' ) && ! SCRIPT_DEBUG ? GUTENBERG_VERSION : time(); |
| 14 |
wp_deregister_script_module( '@wordpress/interactivity' ); |
| 15 |
wp_deregister_script_module( '@wordpress/interactivity-router' ); |
| 16 |
|
| 17 |
wp_register_script_module( |
| 18 |
'@wordpress/interactivity', |
| 19 |
gutenberg_url( '/build/interactivity/index.min.js' ), |
| 20 |
array(), |
| 21 |
$default_version |
| 22 |
); |
| 23 |
|
| 24 |
wp_register_script_module( |
| 25 |
'@wordpress/interactivity-router', |
| 26 |
gutenberg_url( '/build/interactivity/router.min.js' ), |
| 27 |
array( '@wordpress/interactivity' ), |
| 28 |
$default_version |
| 29 |
); |
| 30 |
} |
| 31 |
|
| 32 |
add_action( 'init', 'gutenberg_reregister_interactivity_script_modules' ); |
| 33 |
|