Skip to content

Commit 22f6768

Browse files
committed
Rename block_editor_preload_paths_all filter block_editor_preload_api_request function
1 parent 04c5464 commit 22f6768

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/wp-admin/edit-form-blocks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
sprintf( '/wp/v2/%s/%d/autosaves?context=edit', $rest_base, $post->ID ),
6060
);
6161

62-
block_editor_preload_api_requests( $preload_paths, $block_editor_context );
62+
block_editor_rest_api_preload( $preload_paths, $block_editor_context );
6363

6464
wp_add_inline_script(
6565
'wp-blocks',

src/wp-includes/block-editor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function get_block_editor_settings( $editor_name, $custom_settings = array() ) {
283283
*
284284
* @return void
285285
*/
286-
function block_editor_preload_api_requests( array $preload_paths, $block_editor_context ) {
286+
function block_editor_rest_api_preload( array $preload_paths, $block_editor_context ) {
287287
global $post;
288288

289289
/**
@@ -294,7 +294,7 @@ function block_editor_preload_api_requests( array $preload_paths, $block_editor_
294294
*
295295
* @param string[] $preload_paths Array of paths to preload.
296296
*/
297-
$preload_paths = apply_filters( 'block_editor_preload_paths_all', $preload_paths, $block_editor_context );
297+
$preload_paths = apply_filters( 'block_editor_rest_api_preload_paths', $preload_paths, $block_editor_context );
298298
if ( ! empty( $block_editor_context->post ) ) {
299299
$selected_post = $block_editor_context->post;
300300

@@ -309,7 +309,7 @@ function block_editor_preload_api_requests( array $preload_paths, $block_editor_
309309
* @param string[] $preload_paths Array of paths to preload.
310310
* @param WP_Post $selected_post Post being edited.
311311
*/
312-
$preload_paths = apply_filters_deprecated( 'block_editor_preload_paths', array( $preload_paths, $selected_post ), '5.8.0', 'block_editor_preload_paths_all' );
312+
$preload_paths = apply_filters_deprecated( 'block_editor_preload_paths', array( $preload_paths, $selected_post ), '5.8.0', 'block_editor_rest_api_preload_paths' );
313313
}
314314

315315
if ( empty( $preload_paths ) ) {

tests/phpunit/tests/blocks/block-editor.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ function test_get_block_editor_settings_deprecated_filter_post_editor() {
321321
/**
322322
* @ticket 52920
323323
*/
324-
function test_block_editor_preload_api_requests_no_paths() {
324+
function test_block_editor_rest_api_preload_no_paths() {
325325
$context = new WP_Block_Editor_Context();
326-
block_editor_preload_api_requests( array(), $context );
326+
block_editor_rest_api_preload( array(), $context );
327327

328328
$after = implode( '', wp_scripts()->registered['wp-api-fetch']->extra['after'] );
329329
$this->assertNotContains( 'wp.apiFetch.createPreloadingMiddleware', $after );
@@ -333,7 +333,7 @@ function test_block_editor_preload_api_requests_no_paths() {
333333
* @ticket 52920
334334
* @expectedDeprecated block_editor_preload_paths
335335
*/
336-
function test_block_editor_preload_api_requests_deprecated_filter_post_editor() {
336+
function test_block_editor_rest_api_preload_deprecated_filter_post_editor() {
337337
function filter_remove_preload_paths( $preload_paths, $post ) {
338338
if ( empty( $post ) ) {
339339
return $preload_paths;
@@ -343,7 +343,7 @@ function filter_remove_preload_paths( $preload_paths, $post ) {
343343
add_filter( 'block_editor_preload_paths', 'filter_remove_preload_paths', 10, 2 );
344344

345345
$context = new WP_Block_Editor_Context( array( 'post' => get_post() ) );
346-
block_editor_preload_api_requests(
346+
block_editor_rest_api_preload(
347347
array(
348348
array( '/wp/v2/blocks', 'OPTIONS' ),
349349
),
@@ -359,25 +359,25 @@ function filter_remove_preload_paths( $preload_paths, $post ) {
359359
/**
360360
* @ticket 52920
361361
*/
362-
function test_block_editor_preload_api_requests_filter_all() {
362+
function test_block_editor_rest_api_preload_filter_all() {
363363
function filter_add_preload_paths( $preload_paths, WP_Block_Editor_Context $context ) {
364364
if ( empty( $context->post ) ) {
365365
array_push( $preload_paths, array( '/wp/v2/types', 'OPTIONS' ) );
366366
}
367367

368368
return $preload_paths;
369369
}
370-
add_filter( 'block_editor_preload_paths_all', 'filter_add_preload_paths', 10, 2 );
370+
add_filter( 'block_editor_rest_api_preload_paths', 'filter_add_preload_paths', 10, 2 );
371371

372372
$context = new WP_Block_Editor_Context();
373-
block_editor_preload_api_requests(
373+
block_editor_rest_api_preload(
374374
array(
375375
array( '/wp/v2/blocks', 'OPTIONS' ),
376376
),
377377
$context
378378
);
379379

380-
remove_filter( 'block_editor_preload_paths_all', 'filter_add_preload_paths' );
380+
remove_filter( 'block_editor_rest_api_preload_paths', 'filter_add_preload_paths' );
381381

382382
$after = implode( '', wp_scripts()->registered['wp-api-fetch']->extra['after'] );
383383
$this->assertContains( 'wp.apiFetch.createPreloadingMiddleware', $after );

0 commit comments

Comments
 (0)