Editor: Add deprecated functions from interactivity core blocks.

In 6.5 we are removing a couple of functions in Core blocks that were enqueuing the files needed to add that interactivity. Interactivity is handled with modules, so those functions are not needed anymore and are deprecated.

Props swissspidy, cbravobernal.
Fixes #60380.

git-svn-id: https://develop.svn.wordpress.org/trunk@57511 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Riad Benguella 2024-02-01 09:29:38 +00:00
parent ef37e6bf82
commit 3600105163

View File

@ -6239,3 +6239,60 @@ function the_block_template_skip_link() {
</script>
<?php
}
/**
* Ensure that the view script has the `wp-interactivity` dependency.
*
* @since 6.4.0
* @deprecated 6.5.0
*
* @global WP_Scripts $wp_scripts
*/
function block_core_query_ensure_interactivity_dependency() {
_deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
global $wp_scripts;
if (
isset( $wp_scripts->registered['wp-block-query-view'] ) &&
! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-query-view']->deps, true )
) {
$wp_scripts->registered['wp-block-query-view']->deps[] = 'wp-interactivity';
}
}
/**
* Ensure that the view script has the `wp-interactivity` dependency.
*
* @since 6.4.0
* @deprecated 6.5.0
*
* @global WP_Scripts $wp_scripts
*/
function block_core_file_ensure_interactivity_dependency() {
_deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
global $wp_scripts;
if (
isset( $wp_scripts->registered['wp-block-file-view'] ) &&
! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-file-view']->deps, true )
) {
$wp_scripts->registered['wp-block-file-view']->deps[] = 'wp-interactivity';
}
}
/**
* Ensures that the view script has the `wp-interactivity` dependency.
*
* @since 6.4.0
* @deprecated 6.5.0
*
* @global WP_Scripts $wp_scripts
*/
function block_core_image_ensure_interactivity_dependency() {
_deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
global $wp_scripts;
if (
isset( $wp_scripts->registered['wp-block-image-view'] ) &&
! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-image-view']->deps, true )
) {
$wp_scripts->registered['wp-block-image-view']->deps[] = 'wp-interactivity';
}
}