Build/Test Tools: Revert [51259-51256,51265].

[51259] introduced a PHP notice that was not actually fixed by [51265]. Reverting these changes in order to investigate further.

See #53397.
Built from https://develop.svn.wordpress.org/trunk@51268


git-svn-id: http://core.svn.wordpress.org/trunk@50877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj
2021-06-30 02:14:56 +00:00
parent e7387a9ace
commit 8c3e1e9aa8
7 changed files with 15 additions and 213 deletions

View File

@@ -42,16 +42,12 @@ function generate_block_asset_handle( $block_name, $field_name ) {
if ( 0 === strpos( $field_name, 'editor' ) ) {
$asset_handle .= '-editor';
}
if ( 0 === strpos( $field_name, 'view' ) ) {
$asset_handle .= '-view';
}
return $asset_handle;
}
$field_mappings = array(
'editorScript' => 'editor-script',
'script' => 'script',
'viewScript' => 'view-script',
'editorStyle' => 'editor-style',
'style' => 'style',
);
@@ -105,23 +101,18 @@ function register_block_script_handle( $metadata, $field_name ) {
);
return false;
}
$is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], ABSPATH . WPINC );
$script_uri = $is_core_block ?
includes_url( str_replace( ABSPATH . WPINC, '', realpath( dirname( $metadata['file'] ) . '/' . $script_path ) ) ) :
plugins_url( $script_path, $metadata['file'] );
$script_asset = require $script_asset_path;
$script_dependencies = isset( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : array();
$result = wp_register_script(
$script_asset = require $script_asset_path;
$result = wp_register_script(
$script_handle,
$script_uri,
$script_dependencies,
isset( $script_asset['version'] ) ? $script_asset['version'] : false
plugins_url( $script_path, $metadata['file'] ),
$script_asset['dependencies'],
$script_asset['version']
);
if ( ! $result ) {
return false;
}
if ( ! empty( $metadata['textdomain'] ) && in_array( 'wp-i18n', $script_dependencies ) ) {
if ( ! empty( $metadata['textdomain'] ) ) {
wp_set_script_translations( $script_handle, $metadata['textdomain'] );
}
@@ -320,13 +311,6 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
);
}
if ( ! empty( $metadata['viewScript'] ) ) {
$settings['view_script'] = register_block_script_handle(
$metadata,
'viewScript'
);
}
if ( ! empty( $metadata['editorStyle'] ) ) {
$settings['editor_style'] = register_block_style_handle(
$metadata,