diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:51:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:51:18 +0000 |
commit | 0e41b5d52fdc6af6442816b5f465c9db9f84e126 (patch) | |
tree | e139a90049b158d4eed892d1662ee7f5c358fa31 /wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | |
parent | Adding upstream version 6.5.5+dfsg1. (diff) | |
download | wordpress-0e41b5d52fdc6af6442816b5f465c9db9f84e126.tar.xz wordpress-0e41b5d52fdc6af6442816b5f465c9db9f84e126.zip |
Adding upstream version 6.6.1+dfsg1.upstream/6.6.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php')
-rw-r--r-- | wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php index d8f0839..065b863 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php @@ -162,6 +162,12 @@ class WP_REST_Block_Patterns_Controller extends WP_REST_Controller { * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function prepare_item_for_response( $item, $request ) { + // Resolve pattern blocks so they don't need to be resolved client-side + // in the editor, improving performance. + $blocks = parse_blocks( $item['content'] ); + $blocks = resolve_pattern_blocks( $blocks ); + $item['content'] = serialize_blocks( $blocks ); + $fields = $this->get_fields_for_response( $request ); $keys = array( 'name' => 'name', |