-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modules API: Script Modules add deregister option. (#58830)
* Add deregister module function * Sync with core PR
- Loading branch information
1 parent
5044d4c
commit 1605148
Showing
5 changed files
with
58 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Interactivity API functions specific for the Gutenberg editor plugin. | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
||
/** | ||
* Deregisters the Core Interactivity API Modules and replace them | ||
* with the ones from the Gutenberg plugin. | ||
*/ | ||
function gutenberg_reregister_interactivity_script_modules() { | ||
$default_version = defined( 'GUTENBERG_VERSION' ) && ! SCRIPT_DEBUG ? GUTENBERG_VERSION : time(); | ||
wp_deregister_script_module( '@wordpress/interactivity' ); | ||
wp_deregister_script_module( '@wordpress/interactivity-router' ); | ||
|
||
wp_register_script_module( | ||
'@wordpress/interactivity', | ||
gutenberg_url( '/build/interactivity/index.min.js' ), | ||
array(), | ||
$default_version | ||
); | ||
|
||
wp_register_script_module( | ||
'@wordpress/interactivity-router', | ||
gutenberg_url( '/build/interactivity/router.min.js' ), | ||
array( '@wordpress/interactivity' ), | ||
$default_version | ||
); | ||
} | ||
|
||
add_action( 'init', 'gutenberg_reregister_interactivity_script_modules' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters