Changeset 56044 for trunk/src/wp-includes/blocks.php
- Timestamp:
- 06/26/2023 09:15:21 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/blocks.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r56021 r56044 187 187 } 188 188 189 $style_handle = $metadata[ $field_name ]; 190 if ( is_array( $style_handle ) ) { 191 if ( empty( $style_handle[ $index ] ) ) { 192 return false; 193 } 194 $style_handle = $style_handle[ $index ]; 195 } 196 197 $style_handle_name = generate_block_asset_handle( $metadata['name'], $field_name, $index ); 198 // If the style handle is already registered, skip re-registering. 199 if ( wp_style_is( $style_handle_name, 'registered' ) ) { 200 return $style_handle_name; 201 } 202 189 203 static $wpinc_path_norm = ''; 190 204 if ( ! $wpinc_path_norm ) { … … 196 210 if ( $is_core_block && ! wp_should_load_separate_core_block_assets() ) { 197 211 return false; 198 }199 200 $style_handle = $metadata[ $field_name ];201 if ( is_array( $style_handle ) ) {202 if ( empty( $style_handle[ $index ] ) ) {203 return false;204 }205 $style_handle = $style_handle[ $index ];206 212 } 207 213 … … 247 253 } 248 254 249 $style_handle = generate_block_asset_handle( $metadata['name'], $field_name, $index ); 250 $version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false; 251 $result = wp_register_style( 252 $style_handle, 255 $version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false; 256 $result = wp_register_style( 257 $style_handle_name, 253 258 $style_uri, 254 259 array(), … … 260 265 261 266 if ( $has_style_file ) { 262 wp_style_add_data( $style_handle , 'path', $style_path_norm );267 wp_style_add_data( $style_handle_name, 'path', $style_path_norm ); 263 268 264 269 if ( $is_core_block ) { … … 269 274 270 275 if ( is_rtl() && file_exists( $rtl_file ) ) { 271 wp_style_add_data( $style_handle , 'rtl', 'replace' );272 wp_style_add_data( $style_handle , 'suffix', $suffix );273 wp_style_add_data( $style_handle , 'path', $rtl_file );274 } 275 } 276 277 return $style_handle ;276 wp_style_add_data( $style_handle_name, 'rtl', 'replace' ); 277 wp_style_add_data( $style_handle_name, 'suffix', $suffix ); 278 wp_style_add_data( $style_handle_name, 'path', $rtl_file ); 279 } 280 } 281 282 return $style_handle_name; 278 283 } 279 284 … … 321 326 static $core_blocks_meta; 322 327 if ( ! $core_blocks_meta ) { 323 $core_blocks_meta = require _onceABSPATH . WPINC . '/blocks/blocks-json.php';328 $core_blocks_meta = require ABSPATH . WPINC . '/blocks/blocks-json.php'; 324 329 } 325 330
Note: See TracChangeset
for help on using the changeset viewer.