11<?php
22/**
3- * Creates CMB2 objects/fields endpoint for WordPres REST API
4- * allows access to what fields are registered to a specific post type and more.
3+ * Creates CMB2 objects/fields endpoint for WordPres REST API.
4+ * Allows access to fields registered to a specific post type and more.
55 *
66 * @since 2.1.3
77 *
1111 * @license GPL-2.0+
1212 * @link http://webdevstudios.com
1313 */
14-
1514class CMB2_REST_Endpoints extends WP_REST_Controller {
1615
1716 /**
@@ -132,7 +131,7 @@ public function prepare_item_for_response( $data, $request ) {
132131 $ context = ! empty ( $ request ['context ' ] ) ? $ request ['context ' ] : 'view ' ;
133132 $ data = $ this ->filter_response_by_context ( $ data , $ context );
134133
135- return apply_filters ( 'rest_prepare_cmb2 ' , $ data , $ request );
134+ return apply_filters ( 'cmb2_rest_prepare ' , $ data , $ request );
136135 }
137136
138137 /**
@@ -142,27 +141,23 @@ public function prepare_item_for_response( $data, $request ) {
142141 */
143142 public function get_item_schema () {
144143 $ schema = array (
145- '$schema ' => 'http://json-schema.org/draft-04/schema# ' ,
146- 'title ' => 'CMB2 ' ,
147- 'type ' => 'object ' ,
148- 'properties ' => array (
144+ '$schema ' => 'http://json-schema.org/draft-04/schema# ' ,
145+ 'title ' => 'CMB2 ' ,
146+ 'type ' => 'object ' ,
147+ 'properties ' => array (
149148 'description ' => array (
150- 'description ' => 'A human-readable description of the object. ' ,
151- 'type ' => 'string ' ,
152- 'context ' => array ( 'view ' ),
153- ),
154- 'name ' => array (
155- 'description ' => 'The id for the object. ' ,
156- 'type ' => 'integer ' ,
157- 'context ' => array ( 'view ' ),
158- ),
159- 'name ' => array (
160- 'description ' => 'The title for the object. ' ,
161- 'type ' => 'string ' ,
162- 'context ' => array ( 'view ' ),
163- ),
149+ 'description ' => 'A human-readable description of the object. ' ,
150+ 'type ' => 'string ' ,
151+ 'context ' => array ( 'view ' ),
152+ ),
153+ 'name ' => array (
154+ 'description ' => 'The title for the object. ' ,
155+ 'type ' => 'string ' ,
156+ 'context ' => array ( 'view ' ),
164157 ),
165- );
158+ ),
159+ );
160+
166161 return $ this ->add_additional_fields_schema ( $ schema );
167162 }
168163
0 commit comments