Changeset 51268 for trunk/src/wp-includes/blocks.php
- Timestamp:
- 06/30/2021 02:13:30 AM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/blocks.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r51267 r51268 43 43 $asset_handle .= '-editor'; 44 44 } 45 if ( 0 === strpos( $field_name, 'view' ) ) {46 $asset_handle .= '-view';47 }48 45 return $asset_handle; 49 46 } … … 52 49 'editorScript' => 'editor-script', 53 50 'script' => 'script', 54 'viewScript' => 'view-script',55 51 'editorStyle' => 'editor-style', 56 52 'style' => 'style', … … 106 102 return false; 107 103 } 108 $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], ABSPATH . WPINC ); 109 $script_uri = $is_core_block ? 110 includes_url( str_replace( ABSPATH . WPINC, '', realpath( dirname( $metadata['file'] ) . '/' . $script_path ) ) ) : 111 plugins_url( $script_path, $metadata['file'] ); 112 $script_asset = require $script_asset_path; 113 $script_dependencies = isset( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : array(); 114 $result = wp_register_script( 104 $script_asset = require $script_asset_path; 105 $result = wp_register_script( 115 106 $script_handle, 116 $script_uri,117 $script_ dependencies,118 isset( $script_asset['version'] ) ? $script_asset['version'] : false107 plugins_url( $script_path, $metadata['file'] ), 108 $script_asset['dependencies'], 109 $script_asset['version'] 119 110 ); 120 111 if ( ! $result ) { … … 122 113 } 123 114 124 if ( ! empty( $metadata['textdomain'] ) && in_array( 'wp-i18n', $script_dependencies )) {115 if ( ! empty( $metadata['textdomain'] ) ) { 125 116 wp_set_script_translations( $script_handle, $metadata['textdomain'] ); 126 117 } … … 321 312 } 322 313 323 if ( ! empty( $metadata['viewScript'] ) ) {324 $settings['view_script'] = register_block_script_handle(325 $metadata,326 'viewScript'327 );328 }329 330 314 if ( ! empty( $metadata['editorStyle'] ) ) { 331 315 $settings['editor_style'] = register_block_style_handle(
Note: See TracChangeset
for help on using the changeset viewer.