From 49bf14e11a4b74eb781f69b003819d298468458d Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Wed, 13 Sep 2023 17:46:38 +0200 Subject: [PATCH] Update REST API field schema --- .../class-wp-rest-block-types-controller.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php index 0514a0e096384..cb3fb2fc3debd 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php @@ -707,15 +707,17 @@ public function get_item_schema() { 'keywords' => $keywords_definition, 'example' => $example_definition, 'block_hooks' => array( - 'description' => __( 'Block hooks.' ), - 'type' => 'object', - 'properties' => array(), - 'additionalProperties' => array( - 'type' => 'string', + 'description' => __( 'This block is automatically inserted near any occurence of the block types used as keys of this map, into a relative position given by the corresponding value.' ), + 'type' => 'object', + 'patternProperties' => array( + '^[a-zA-Z0-9-]+/[a-zA-Z0-9-]+$' => array( + 'type' => 'string', + 'enum' => array( 'before', 'after', 'first_child', 'last_child' ), + ), ), - 'default' => array(), - 'context' => array( 'embed', 'view', 'edit' ), - 'readonly' => true, + 'default' => array(), + 'context' => array( 'embed', 'view', 'edit' ), + 'readonly' => true, ), ), );