Changeset 58334
- Timestamp:
- 06/04/2024 02:50:24 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/global-styles-and-settings.php
r58262 r58334 308 308 $tree = WP_Theme_JSON_Resolver::get_merged_data(); 309 309 $block_nodes = $tree->get_styles_block_nodes(); 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 310 332 foreach ( $block_nodes as $metadata ) { 311 $block_css = $tree->get_styles_for_block( $metadata ); 333 334 if ( $can_use_cached ) { 335 // Use the block name as the key for cached CSS data. Otherwise, use a hash of the metadata. 336 $cache_node_key = isset( $metadata['name'] ) ? $metadata['name'] : md5( wp_json_encode( $metadata ) ); 337 338 if ( isset( $cached[ $cache_node_key ] ) ) { 339 $block_css = $cached[ $cache_node_key ]; 340 } else { 341 $block_css = $tree->get_styles_for_block( $metadata ); 342 $cached[ $cache_node_key ] = $block_css; 343 $update_cache = true; 344 } 345 } else { 346 $block_css = $tree->get_styles_for_block( $metadata ); 347 } 312 348 313 349 if ( ! wp_should_load_separate_core_block_assets() ) { … … 355 391 } 356 392 } 393 394 395 396 357 397 } 358 398 -
trunk/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php
r58295 r58334 77 77 78 78 /** 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 79 160 * @ticket 56915 80 161 * @ticket 61165 … … 254 335 return is_array( $actual ) ? $actual : array(); 255 336 } 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 256 358 }
Note: See TracChangeset
for help on using the changeset viewer.