Skip to content

Commit e7cec6b

Browse files
committed
Rename wp_load_block_styles_on_demand_in_classic_themes() to wp_load_classic_theme_block_styles_on_demand()
1 parent 44c0d06 commit e7cec6b

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

src/wp-includes/default-filters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@
595595
add_action( 'enqueue_block_assets', 'wp_enqueue_classic_theme_styles' );
596596
add_action( 'enqueue_block_assets', 'wp_enqueue_registered_block_scripts_and_styles' );
597597
add_action( 'enqueue_block_assets', 'enqueue_block_styles_assets', 30 );
598-
add_action( 'init', 'wp_load_block_styles_on_demand_in_classic_themes', 8 ); // Must happen before register_core_block_style_handles() at priority 9.
598+
add_action( 'init', 'wp_load_classic_theme_block_styles_on_demand', 8 ); // Must happen before register_core_block_style_handles() at priority 9.
599599
/*
600600
* `wp_enqueue_registered_block_scripts_and_styles` is bound to both
601601
* `enqueue_block_editor_assets` and `enqueue_block_assets` hooks

src/wp-includes/script-loader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,7 +2264,7 @@ function wp_print_head_scripts() {
22642264
/**
22652265
* Private, for use in *_footer_scripts hooks
22662266
*
2267-
* In classic themes, when block styles are loaded on demand via {@see wp_load_block_styles_on_demand_in_classic_themes()},
2267+
* In classic themes, when block styles are loaded on demand via {@see wp_load_classic_theme_block_styles_on_demand()},
22682268
* this function is replaced by a closure in {@see wp_hoist_late_printed_styles()} which will capture the output of
22692269
* {@see print_late_styles()} before printing footer scripts as usual. The captured late-printed styles are then hoisted
22702270
* to the HEAD by means of the template enhancement output buffer.
@@ -3237,7 +3237,7 @@ static function () use ( $style ) {
32373237
* }
32383238
*/
32393239
function wp_enqueue_stored_styles( $options = array() ) {
3240-
// Note: Styles printed at wp_footer for classic themes may still end up in the head due to wp_load_block_styles_on_demand_in_classic_themes().
3240+
// Note: Styles printed at wp_footer for classic themes may still end up in the head due to wp_load_classic_theme_block_styles_on_demand().
32413241
$is_block_theme = wp_is_block_theme();
32423242
$is_classic_theme = ! $is_block_theme;
32433243

@@ -3480,7 +3480,7 @@ function wp_remove_surrounding_empty_script_tags( $contents ) {
34803480
*
34813481
* @since 6.9.0
34823482
*/
3483-
function wp_load_block_styles_on_demand_in_classic_themes() {
3483+
function wp_load_classic_theme_block_styles_on_demand() {
34843484
if ( wp_is_block_theme() ) {
34853485
return;
34863486
}
@@ -3514,7 +3514,7 @@ function wp_load_block_styles_on_demand_in_classic_themes() {
35143514
*
35153515
* @since 6.9.0
35163516
*
3517-
* @see wp_load_block_styles_on_demand_in_classic_themes()
3517+
* @see wp_load_classic_theme_block_styles_on_demand()
35183518
* @see _wp_footer_scripts()
35193519
*/
35203520
function wp_hoist_late_printed_styles() {

tests/phpunit/tests/dependencies/styles.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public function test_block_styles_for_editing_without_theme_support() {
436436
* @covers ::wp_common_block_scripts_and_styles
437437
*/
438438
public function test_block_styles_for_editing_with_theme_support() {
439-
// Override wp_load_block_styles_on_demand_in_classic_themes().
439+
// Override wp_load_classic_theme_block_styles_on_demand().
440440
add_filter( 'should_load_separate_core_block_assets', '__return_false' );
441441

442442
add_theme_support( 'wp-block-styles' );
@@ -475,7 +475,7 @@ public function test_no_block_styles_for_viewing_without_theme_support() {
475475
* @covers ::wp_common_block_scripts_and_styles
476476
*/
477477
public function test_block_styles_for_viewing_with_theme_support() {
478-
// Override wp_load_block_styles_on_demand_in_classic_themes().
478+
// Override wp_load_classic_theme_block_styles_on_demand().
479479
add_filter( 'should_load_separate_core_block_assets', '__return_false' );
480480

481481
add_theme_support( 'wp-block-styles' );

tests/phpunit/tests/template.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function set_up() {
9797
);
9898
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
9999

100-
// Remove hooks which are added by wp_load_block_styles_on_demand_in_classic_themes() during bootstrapping.
100+
// Remove hooks which are added by wp_load_classic_theme_block_styles_on_demand() during bootstrapping.
101101
remove_filter( 'wp_should_output_buffer_template_for_enhancement', '__return_true', 0 );
102102
remove_filter( 'should_load_separate_core_block_assets', '__return_true', 0 );
103103
remove_filter( 'should_load_block_assets_on_demand', '__return_true', 0 );
@@ -536,11 +536,11 @@ public function test_locate_template_uses_current_theme() {
536536
* @ticket 64099
537537
* @covers ::wp_should_output_buffer_template_for_enhancement
538538
* @covers ::wp_start_template_enhancement_output_buffer
539-
* @covers ::wp_load_block_styles_on_demand_in_classic_themes
539+
* @covers ::wp_load_classic_theme_block_styles_on_demand
540540
*/
541541
public function test_wp_start_template_enhancement_output_buffer_without_filters_and_no_override_in_block_theme(): void {
542542
switch_theme( 'block-theme' );
543-
wp_load_block_styles_on_demand_in_classic_themes();
543+
wp_load_classic_theme_block_styles_on_demand();
544544

545545
$level = ob_get_level();
546546
$this->assertFalse( wp_should_output_buffer_template_for_enhancement(), 'Expected wp_should_output_buffer_template_for_enhancement() to return false when there are no wp_template_enhancement_output_buffer filters added.' );
@@ -556,14 +556,14 @@ public function test_wp_start_template_enhancement_output_buffer_without_filters
556556
* @ticket 64099
557557
* @covers ::wp_should_output_buffer_template_for_enhancement
558558
* @covers ::wp_start_template_enhancement_output_buffer
559-
* @covers ::wp_load_block_styles_on_demand_in_classic_themes
559+
* @covers ::wp_load_classic_theme_block_styles_on_demand
560560
*/
561561
public function test_wp_start_template_enhancement_output_buffer_in_classic_theme(): void {
562562
switch_theme( 'default' );
563-
wp_load_block_styles_on_demand_in_classic_themes();
563+
wp_load_classic_theme_block_styles_on_demand();
564564

565565
$level = ob_get_level();
566-
$this->assertTrue( wp_should_output_buffer_template_for_enhancement(), 'Expected wp_should_output_buffer_template_for_enhancement() to return true because wp_load_block_styles_on_demand_in_classic_themes() adds wp_template_enhancement_output_buffer filters.' );
566+
$this->assertTrue( wp_should_output_buffer_template_for_enhancement(), 'Expected wp_should_output_buffer_template_for_enhancement() to return true because wp_load_classic_theme_block_styles_on_demand() adds wp_template_enhancement_output_buffer filters.' );
567567
$this->assertTrue( wp_start_template_enhancement_output_buffer(), 'Expected wp_start_template_enhancement_output_buffer() to return true because the output buffer should be started.' );
568568
$this->assertSame( 1, did_action( 'wp_template_enhancement_output_buffer_started' ), 'Expected the wp_template_enhancement_output_buffer_started action to have fired.' );
569569
$this->assertSame( $level + 1, ob_get_level(), 'Expected the initial output buffer level to be incremented by one.' );
@@ -894,52 +894,52 @@ public function test_wp_start_template_enhancement_output_buffer_for_json(): voi
894894
}
895895

896896
/**
897-
* Tests that wp_load_block_styles_on_demand_in_classic_themes() does not add hooks for block themes.
897+
* Tests that wp_load_classic_theme_block_styles_on_demand() does not add hooks for block themes.
898898
*
899899
* @ticket 64099
900-
* @covers ::wp_load_block_styles_on_demand_in_classic_themes
900+
* @covers ::wp_load_classic_theme_block_styles_on_demand
901901
*/
902-
public function test_wp_load_block_styles_on_demand_in_classic_themes_in_block_theme(): void {
902+
public function test_wp_load_classic_theme_block_styles_on_demand_in_block_theme(): void {
903903
switch_theme( 'block-theme' );
904904

905-
wp_load_block_styles_on_demand_in_classic_themes();
905+
wp_load_classic_theme_block_styles_on_demand();
906906

907907
$this->assertFalse( has_filter( 'should_load_separate_core_block_assets' ), 'Expect should_load_separate_core_block_assets filter NOT to be added for block themes.' );
908908
$this->assertFalse( has_filter( 'should_load_block_assets_on_demand', '__return_true' ), 'Expect should_load_block_assets_on_demand filter NOT to be added for block themes.' );
909909
$this->assertFalse( has_action( 'wp_template_enhancement_output_buffer_started', 'wp_hoist_late_printed_styles' ), 'Expect wp_template_enhancement_output_buffer_started action NOT to be added for block themes.' );
910910
}
911911

912912
/**
913-
* Tests that wp_load_block_styles_on_demand_in_classic_themes() does not add hooks for classic themes when output buffering is blocked.
913+
* Tests that wp_load_classic_theme_block_styles_on_demand() does not add hooks for classic themes when output buffering is blocked.
914914
*
915915
* @ticket 64099
916-
* @covers ::wp_load_block_styles_on_demand_in_classic_themes
916+
* @covers ::wp_load_classic_theme_block_styles_on_demand
917917
*/
918-
public function test_wp_load_block_styles_on_demand_in_classic_themes_in_classic_theme_but_output_buffering_blocked(): void {
918+
public function test_wp_load_classic_theme_block_styles_on_demand_in_classic_theme_but_output_buffering_blocked(): void {
919919
add_filter( 'wp_should_output_buffer_template_for_enhancement', '__return_false' );
920920
switch_theme( 'default' );
921921

922-
wp_load_block_styles_on_demand_in_classic_themes();
922+
wp_load_classic_theme_block_styles_on_demand();
923923

924924
$this->assertFalse( has_filter( 'should_load_separate_core_block_assets' ), 'Expect should_load_separate_core_block_assets filter NOT to be added for block themes.' );
925925
$this->assertFalse( has_filter( 'should_load_block_assets_on_demand', '__return_true' ), 'Expect should_load_block_assets_on_demand filter NOT to be added for block themes.' );
926926
$this->assertFalse( has_action( 'wp_template_enhancement_output_buffer_started', 'wp_hoist_late_printed_styles' ), 'Expect wp_template_enhancement_output_buffer_started action NOT to be added for block themes.' );
927927
}
928928

929929
/**
930-
* Tests that wp_load_block_styles_on_demand_in_classic_themes() adds the expected hooks for classic themes.
930+
* Tests that wp_load_classic_theme_block_styles_on_demand() adds the expected hooks for classic themes.
931931
*
932932
* @ticket 64099
933-
* @covers ::wp_load_block_styles_on_demand_in_classic_themes
933+
* @covers ::wp_load_classic_theme_block_styles_on_demand
934934
*/
935-
public function test_wp_load_block_styles_on_demand_in_classic_themes_in_classic_theme(): void {
935+
public function test_wp_load_classic_theme_block_styles_on_demand_in_classic_theme(): void {
936936
switch_theme( 'default' );
937937

938938
$this->assertFalse( wp_should_load_separate_core_block_assets(), 'Expected wp_should_load_separate_core_block_assets() to return false initially.' );
939939
$this->assertFalse( wp_should_load_block_assets_on_demand(), 'Expected wp_should_load_block_assets_on_demand() to return true' );
940940
$this->assertFalse( has_action( 'wp_template_enhancement_output_buffer_started', 'wp_hoist_late_printed_styles' ), 'Expected wp_template_enhancement_output_buffer_started action to be added for classic themes.' );
941941

942-
wp_load_block_styles_on_demand_in_classic_themes();
942+
wp_load_classic_theme_block_styles_on_demand();
943943

944944
$this->assertTrue( wp_should_load_separate_core_block_assets(), 'Expected wp_should_load_separate_core_block_assets() filters to return true' );
945945
$this->assertTrue( wp_should_load_block_assets_on_demand(), 'Expected wp_should_load_block_assets_on_demand() to return true' );

tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public function test_third_party_blocks_inline_styles_get_rendered_when_per_bloc
291291
* @covers ::wp_add_global_styles_for_blocks
292292
*/
293293
public function test_blocks_inline_styles_get_rendered() {
294-
// Override wp_load_block_styles_on_demand_in_classic_themes().
294+
// Override wp_load_classic_theme_block_styles_on_demand().
295295
add_filter( 'should_load_block_assets_on_demand', '__return_false' ); // Needed for the .wp-block-post-featured-image assertion below.
296296

297297
$this->set_up_third_party_block();

0 commit comments

Comments
 (0)