From 0e41b5d52fdc6af6442816b5f465c9db9f84e126 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:51:18 +0200 Subject: Adding upstream version 6.6.1+dfsg1. Signed-off-by: Daniel Baumann --- .../rest-api/endpoints/class-wp-rest-block-patterns-controller.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php') 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', -- cgit v1.2.3