@@ -239,30 +239,30 @@ public function prepare_item_for_response( $block_type, $request ) {
239239
240240 $ schema = $ this ->get_item_schema ();
241241 $ extra_fields = array (
242- 'name ' ,
243- 'title ' ,
244- 'description ' ,
245- 'icon ' ,
246- 'category ' ,
247- 'keywords ' ,
248- 'parent ' ,
249- 'supports ' ,
250- 'styles ' ,
251- 'textdomain ' ,
252- 'example ' ,
253- 'editor_script ' ,
254- 'script ' ,
255- 'editor_style ' ,
256- 'style ' ,
257- 'provides_context ' ,
258- 'use_context ' ,
242+ 'name ' => ' name ' ,
243+ 'title ' => ' title ' ,
244+ 'description ' => ' description ' ,
245+ 'icon ' => ' icon ' ,
246+ 'category ' => ' category ' ,
247+ 'keywords ' => ' keywords ' ,
248+ 'parent ' => ' parent ' ,
249+ 'supports ' => ' supports ' ,
250+ 'styles ' => ' styles ' ,
251+ 'textdomain ' => ' textdomain ' ,
252+ 'example ' => ' example ' ,
253+ 'editor_script ' => ' editor_script ' ,
254+ 'script ' => ' script ' ,
255+ 'editor_style ' => ' editor_style ' ,
256+ 'style ' => ' style ' ,
257+ 'provides_context ' => ' providesContext ' ,
258+ 'use_context ' => ' context ' ,
259259 );
260- foreach ( $ extra_fields as $ extra_field ) {
260+ foreach ( $ extra_fields as $ key => $ extra_field ) {
261261 if ( rest_is_field_included ( $ key , $ fields ) ) {
262262 if ( isset ( $ block_type ->$ extra_field ) ) {
263263 $ field = $ block_type ->$ extra_field ;
264- } elseif ( array_key_exists ( 'default ' , $ schema ['properties ' ][ $ extra_field ] ) ) {
265- $ field = $ schema ['properties ' ][ $ extra_field ]['default ' ];
264+ } elseif ( array_key_exists ( 'default ' , $ schema ['properties ' ][ $ key ] ) ) {
265+ $ field = $ schema ['properties ' ][ $ key ]['default ' ];
266266 } else {
267267 $ field = '' ;
268268 }
@@ -439,14 +439,14 @@ public function get_item_schema() {
439439 'context ' => array ( 'embed ' , 'view ' , 'edit ' ),
440440 'readonly ' => true ,
441441 ),
442- 'textdomain ' => array (
442+ 'textdomain ' => array (
443443 'description ' => __ ( 'Public text domain. ' , 'gutenberg ' ),
444444 'type ' => array ( 'string ' , 'null ' ),
445445 'default ' => null ,
446446 'context ' => array ( 'embed ' , 'view ' , 'edit ' ),
447447 'readonly ' => true ,
448448 ),
449- 'parent ' => array (
449+ 'parent ' => array (
450450 'description ' => __ ( 'Parent blocks. ' , 'gutenberg ' ),
451451 'type ' => array ( 'array ' , 'null ' ),
452452 'items ' => array (
@@ -466,14 +466,16 @@ public function get_item_schema() {
466466 'context ' => array ( 'embed ' , 'view ' , 'edit ' ),
467467 'readonly ' => true ,
468468 ),
469- 'example ' => array (
469+ 'example ' => array (
470470 'description ' => __ ( 'Block example. ' , 'gutenberg ' ),
471471 'type ' => array ( 'object ' , 'null ' ),
472472 'default ' => null ,
473473 'properties ' => array (),
474474 'additionalProperties ' => array (
475475 'type ' => 'object ' ,
476476 ),
477+ 'context ' => array ( 'embed ' , 'view ' , 'edit ' ),
478+ 'readonly ' => true ,
477479 ),
478480 'provides_context ' => array (
479481 'description ' => __ ( 'Context provided by blocks of this type. ' , 'gutenberg ' ),
@@ -486,7 +488,7 @@ public function get_item_schema() {
486488 'context ' => array ( 'embed ' , 'view ' , 'edit ' ),
487489 'readonly ' => true ,
488490 ),
489- 'use_context ' => array (
491+ 'use_context ' => array (
490492 'description ' => __ ( 'Context values inherited by blocks of this type. ' , 'gutenberg ' ),
491493 'type ' => 'array ' ,
492494 'default ' => array (),
0 commit comments