mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Script Loader: Fix PHP notice caused by the viewScript
for the core/file
block.
This fixes a PHP notice caused by the `viewScript` for the `core/file` block having `.min.js` instead of just `.js`. `register_block_script_handle()` was incorrectly looking for `view.min.asset.php`, which does not exist, and caused the `_doing_it_wrong()` notice. This adds a check for `.min.js` in the `viewScript` field of `block.json` and corrects it to `.js` in order to match the expected pattern of `view.asset.php` until a more permanent fix can be created. Follow up to [51259]. Props ipstenu, pbiron, peterwilsoncc. See #53397. Built from https://develop.svn.wordpress.org/trunk@51267 git-svn-id: http://core.svn.wordpress.org/trunk@50876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1b7cd950ca
commit
e7387a9ace
@ -82,7 +82,12 @@ function register_block_script_handle( $metadata, $field_name ) {
|
|||||||
return $script_handle;
|
return $script_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
$script_handle = generate_block_asset_handle( $metadata['name'], $field_name );
|
$script_handle = generate_block_asset_handle( $metadata['name'], $field_name );
|
||||||
|
|
||||||
|
if ( 'viewScript' === $field_name ) {
|
||||||
|
$script_path = str_replace( '.min.js', '.js', $script_path );
|
||||||
|
}
|
||||||
|
|
||||||
$script_asset_path = realpath(
|
$script_asset_path = realpath(
|
||||||
dirname( $metadata['file'] ) . '/' .
|
dirname( $metadata['file'] ) . '/' .
|
||||||
substr_replace( $script_path, '.asset.php', - strlen( '.js' ) )
|
substr_replace( $script_path, '.asset.php', - strlen( '.js' ) )
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.8-beta4-51266';
|
$wp_version = '5.8-beta4-51267';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user