@@ -107,19 +107,19 @@ public function get_items( $request ) {
107107 public function prepare_item_for_response ( $ item , $ request ) {
108108 $ fields = $ this ->get_fields_for_response ( $ request );
109109 $ keys = array (
110- 'name ' ,
111- 'title ' ,
112- 'description ' ,
113- 'viewportWidth ' ,
114- 'blockTypes ' ,
115- 'categories ' ,
116- 'keywords ' ,
117- 'content ' ,
110+ 'name ' => ' name ' ,
111+ 'title ' => ' title ' ,
112+ 'description ' => ' description ' ,
113+ 'viewportWidth ' => ' viewport_width ' ,
114+ 'blockTypes ' => ' block_types ' ,
115+ 'categories ' => ' categories ' ,
116+ 'keywords ' => ' keywords ' ,
117+ 'content ' => ' content ' ,
118118 );
119119 $ data = array ();
120- foreach ( $ keys as $ key ) {
121- if ( isset ( $ item [ $ key ] ) && rest_is_field_included ( $ key , $ fields ) ) {
122- $ data [ $ key ] = $ item [ $ key ];
120+ foreach ( $ keys as $ item_key => $ rest_key ) {
121+ if ( isset ( $ item [ $ item_key ] ) && rest_is_field_included ( $ rest_key , $ fields ) ) {
122+ $ data [ $ rest_key ] = $ item [ $ item_key ];
123123 }
124124 }
125125
@@ -142,49 +142,49 @@ public function get_item_schema() {
142142 'title ' => 'block-pattern ' ,
143143 'type ' => 'object ' ,
144144 'properties ' => array (
145- 'name ' => array (
145+ 'name ' => array (
146146 'description ' => __ ( 'The pattern name. ' ),
147147 'type ' => 'string ' ,
148148 'readonly ' => true ,
149149 'context ' => array ( 'view ' , 'edit ' , 'embed ' ),
150150 ),
151- 'title ' => array (
151+ 'title ' => array (
152152 'description ' => __ ( 'The pattern title, in human readable format. ' ),
153153 'type ' => 'string ' ,
154154 'readonly ' => true ,
155155 'context ' => array ( 'view ' , 'edit ' , 'embed ' ),
156156 ),
157- 'description ' => array (
157+ 'description ' => array (
158158 'description ' => __ ( 'The pattern detailed description. ' ),
159159 'type ' => 'string ' ,
160160 'readonly ' => true ,
161161 'context ' => array ( 'view ' , 'edit ' , 'embed ' ),
162162 ),
163- 'viewportWidth ' => array (
163+ 'viewport_Width ' => array (
164164 'description ' => __ ( 'The pattern viewport width for inserter preview. ' ),
165165 'type ' => 'number ' ,
166166 'readonly ' => true ,
167167 'context ' => array ( 'view ' , 'edit ' , 'embed ' ),
168168 ),
169- 'blockTypes ' => array (
169+ 'block_Types ' => array (
170170 'description ' => __ ( 'Block types that the pattern is intended to be used with. ' ),
171171 'type ' => 'array ' ,
172172 'readonly ' => true ,
173173 'context ' => array ( 'view ' , 'edit ' , 'embed ' ),
174174 ),
175- 'categories ' => array (
175+ 'categories ' => array (
176176 'description ' => __ ( 'The pattern category slugs. ' ),
177177 'type ' => 'array ' ,
178178 'readonly ' => true ,
179179 'context ' => array ( 'view ' , 'edit ' , 'embed ' ),
180180 ),
181- 'keywords ' => array (
181+ 'keywords ' => array (
182182 'description ' => __ ( 'The pattern keywords. ' ),
183183 'type ' => 'array ' ,
184184 'readonly ' => true ,
185185 'context ' => array ( 'view ' , 'edit ' , 'embed ' ),
186186 ),
187- 'content ' => array (
187+ 'content ' => array (
188188 'description ' => __ ( 'The pattern content. ' ),
189189 'type ' => 'string ' ,
190190 'readonly ' => true ,
0 commit comments