Changeset 51471 for trunk/src/wp-includes/script-loader.php
- Timestamp:
- 07/22/2021 08:36:11 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/script-loader.php
r51469 r51471 2437 2437 $block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered(); 2438 2438 2439 foreach ( $block_styles as $ styles ) {2439 foreach ( $block_styles as $block_name => $styles ) { 2440 2440 foreach ( $styles as $style_properties ) { 2441 2441 if ( isset( $style_properties['style_handle'] ) ) { 2442 wp_enqueue_style( $style_properties['style_handle'] ); 2442 2443 // If the site loads separate styles per-block, enqueue the stylesheet on render. 2444 if ( wp_should_load_separate_core_block_assets() ) { 2445 add_filter( 2446 'render_block', 2447 function( $html, $block ) use ( $style_properties ) { 2448 wp_enqueue_style( $style_properties['style_handle'] ); 2449 return $html; 2450 } 2451 ); 2452 } else { 2453 wp_enqueue_style( $style_properties['style_handle'] ); 2454 } 2443 2455 } 2444 2456 if ( isset( $style_properties['inline_style'] ) ) { 2445 wp_add_inline_style( 'wp-block-library', $style_properties['inline_style'] ); 2457 2458 // Default to "wp-block-library". 2459 $handle = 'wp-block-library'; 2460 2461 // If the site loads separate styles per-block, check if the block has a stylesheet registered. 2462 if ( wp_should_load_separate_core_block_assets() ) { 2463 $block_stylesheet_handle = generate_block_asset_handle( $block_name, 'style' ); 2464 global $wp_styles; 2465 if ( isset( $wp_styles->registered[ $block_stylesheet_handle ] ) ) { 2466 $handle = $block_stylesheet_handle; 2467 } 2468 } 2469 2470 // Add inline styles to the calculated handle. 2471 wp_add_inline_style( $handle, $style_properties['inline_style'] ); 2446 2472 } 2447 2473 }
Note: See TracChangeset
for help on using the changeset viewer.