Skip to content

Commit dda17bd

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents f870f80 + 76f9763 commit dda17bd

3 files changed

Lines changed: 0 additions & 100 deletions

File tree

src/wp-includes/default-filters.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@
644644
add_action( 'enqueue_block_editor_assets', 'wp_enqueue_block_editor_script_modules' );
645645
add_action( 'enqueue_block_editor_assets', 'wp_enqueue_global_styles_css_custom_properties' );
646646
add_action( 'enqueue_block_editor_assets', '_wp_enqueue_auto_register_blocks' );
647-
add_action( 'enqueue_block_editor_assets', 'wp_declare_classic_block_necessary' );
648647
add_action( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
649648
add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
650649
add_action( 'customize_controls_print_styles', 'wp_resource_hints', 1 );

src/wp-includes/script-loader.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,32 +2646,6 @@ function wp_enqueue_global_styles() {
26462646
wp_add_global_styles_for_blocks();
26472647
}
26482648

2649-
/**
2650-
* Declares a flag that the Classic block is necessary for the current post.
2651-
*
2652-
* @since 7.1.0
2653-
* @access private
2654-
*/
2655-
function wp_declare_classic_block_necessary(): void {
2656-
/**
2657-
* Filters whether the Classic block should be available in the inserter.
2658-
*
2659-
* Defaults to false. Use this filter to opt in (globally or per post).
2660-
*
2661-
* @param bool $supports_inserter Whether the Classic block is available in the inserter.
2662-
* @param WP_Post|null $post The post being edited, or null if not in the post editor.
2663-
*/
2664-
if ( ! (bool) apply_filters( 'wp_classic_block_supports_inserter', false, get_post() ) ) {
2665-
return;
2666-
}
2667-
2668-
wp_add_inline_script(
2669-
'wp-block-library',
2670-
'window.__needsClassicBlock = true;',
2671-
'before'
2672-
);
2673-
}
2674-
26752649
/**
26762650
* Checks if the editor scripts and styles for all registered block types
26772651
* should be enqueued on the current screen.

tests/phpunit/tests/dependencies/scripts.php

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -4542,79 +4542,6 @@ public function data_varying_versions_handle_args() {
45424542
);
45434543
}
45444544

4545-
/**
4546-
* Tests that the Classic block is hidden from the inserter by default.
4547-
*
4548-
* @ticket 65166
4549-
*
4550-
* @covers ::wp_declare_classic_block_necessary
4551-
*/
4552-
public function test_wp_declare_classic_block_necessary_does_nothing_by_default() {
4553-
wp_register_script( 'wp-block-library', 'https://example.org/wp-block-library.js' );
4554-
4555-
wp_declare_classic_block_necessary();
4556-
4557-
$this->assertFalse(
4558-
wp_scripts()->get_data( 'wp-block-library', 'before' ),
4559-
'No inline script should be enqueued when the filter is not used.'
4560-
);
4561-
}
4562-
4563-
/**
4564-
* Tests that the Classic block can be opted into the inserter via the filter.
4565-
*
4566-
* @ticket 65166
4567-
*
4568-
* @covers ::wp_declare_classic_block_necessary
4569-
*/
4570-
public function test_wp_declare_classic_block_necessary_enqueues_flag_when_filter_enabled() {
4571-
wp_register_script( 'wp-block-library', 'https://example.org/wp-block-library.js' );
4572-
add_filter( 'wp_classic_block_supports_inserter', '__return_true' );
4573-
4574-
wp_declare_classic_block_necessary();
4575-
4576-
$before = wp_scripts()->get_data( 'wp-block-library', 'before' );
4577-
$this->assertIsArray(
4578-
$before,
4579-
'An inline script should be enqueued when the filter opts in.'
4580-
);
4581-
$this->assertContains(
4582-
'window.__needsClassicBlock = true;',
4583-
$before,
4584-
'The Classic block flag should be added to the wp-block-library inline scripts.'
4585-
);
4586-
}
4587-
4588-
/**
4589-
* Tests that the current post is passed to the filter.
4590-
*
4591-
* @ticket 65166
4592-
*
4593-
* @covers ::wp_declare_classic_block_necessary
4594-
*/
4595-
public function test_wp_declare_classic_block_necessary_passes_post_to_filter() {
4596-
wp_register_script( 'wp-block-library', 'https://example.org/wp-block-library.js' );
4597-
4598-
$post_id = self::factory()->post->create();
4599-
$GLOBALS['post'] = get_post( $post_id );
4600-
4601-
$filter_post = false;
4602-
add_filter(
4603-
'wp_classic_block_supports_inserter',
4604-
static function ( $supports_inserter, $post ) use ( &$filter_post ) {
4605-
$filter_post = $post;
4606-
return $supports_inserter;
4607-
},
4608-
10,
4609-
2
4610-
);
4611-
4612-
wp_declare_classic_block_necessary();
4613-
4614-
$this->assertInstanceOf( WP_Post::class, $filter_post, 'The post should be passed to the filter.' );
4615-
$this->assertSame( $post_id, $filter_post->ID, 'The current post should be passed to the filter.' );
4616-
}
4617-
46184545
/**
46194546
* Normalizes markup for snapshot.
46204547
*

0 commit comments

Comments
 (0)