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.
Built from https://develop.svn.wordpress.org/trunk@57511


git-svn-id: http://core.svn.wordpress.org/trunk@57012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
youknowriad 2024-02-01 09:31:12 +00:00
parent 4624f178a3
commit 7d60c616d1
2 changed files with 58 additions and 1 deletions

View File

@ -6239,3 +6239,60 @@ function the_block_template_skip_link() {
</script> </script>
<?php <?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';
}
}

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-alpha-57510'; $wp_version = '6.5-alpha-57511';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.