@@ -205,7 +205,7 @@ |
||
205 | 205 | * |
206 | 206 | * @since 2.2.4 |
207 | 207 | * |
208 | - * @param mixed $value The value of the field |
|
208 | + * @param mixed $values The value of the field |
|
209 | 209 | * @param object $object The object from the response |
210 | 210 | * @param string $field_name Name of field |
211 | 211 | * @param WP_REST_Request $request Current request |
@@ -127,18 +127,18 @@ discard block |
||
127 | 127 | |
128 | 128 | protected function declare_read_edit_fields() { |
129 | 129 | foreach ( $this->cmb->prop( 'fields' ) as $field ) { |
130 | - $show_in_rest = isset( $field['show_in_rest'] ) ? $field['show_in_rest'] : null; |
|
130 | + $show_in_rest = isset( $field[ 'show_in_rest' ] ) ? $field[ 'show_in_rest' ] : null; |
|
131 | 131 | |
132 | 132 | if ( false === $show_in_rest ) { |
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
136 | 136 | if ( $this->can_read( $show_in_rest ) ) { |
137 | - $this->read_fields[] = $field['id']; |
|
137 | + $this->read_fields[ ] = $field[ 'id' ]; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | if ( $this->can_edit( $show_in_rest ) ) { |
141 | - $this->edit_fields[] = $field['id']; |
|
141 | + $this->edit_fields[ ] = $field[ 'id' ]; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public static function get_restable_field_values( $object, $field_name, $request, $object_type ) { |
180 | 180 | $values = array(); |
181 | - if ( ! isset( $object['id'] ) ) { |
|
181 | + if ( ! isset( $object[ 'id' ] ) ) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | foreach ( self::$boxes as $cmb_id => $rest_box ) { |
187 | 187 | foreach ( $rest_box->read_fields as $field_id ) { |
188 | 188 | $field = $rest_box->cmb->get_field( $field_id ); |
189 | - $field->object_id( $object['id'] ); |
|
189 | + $field->object_id( $object[ 'id' ] ); |
|
190 | 190 | |
191 | 191 | // TODO: test other object types (users, comments, etc) |
192 | 192 | // if ( isset( $object['type'] ) ) { |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | continue; |
233 | 233 | } |
234 | 234 | |
235 | - $rest_box->cmb->object_id( $data['object_id'] ); |
|
236 | - $rest_box->cmb->object_type( $data['object_type'] ); |
|
235 | + $rest_box->cmb->object_id( $data[ 'object_id' ] ); |
|
236 | + $rest_box->cmb->object_type( $data[ 'object_type' ] ); |
|
237 | 237 | |
238 | 238 | // TODO: Test since refactor. |
239 | 239 | $updated[ $cmb_id ] = $rest_box->sanitize_box_values( $values ); |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | } elseif ( isset( $object->comment_ID ) ) { |
342 | 342 | $object_id = intval( $object->comment_ID ); |
343 | 343 | $object_type = 'comment'; |
344 | - } elseif ( is_array( $object ) && isset( $object['term_id'] ) ) { |
|
345 | - $object_id = intval( $object['term_id'] ); |
|
344 | + } elseif ( is_array( $object ) && isset( $object[ 'term_id' ] ) ) { |
|
345 | + $object_id = intval( $object[ 'term_id' ] ); |
|
346 | 346 | $object_type = 'term'; |
347 | 347 | } elseif ( isset( $object->term_id ) ) { |
348 | 348 | $object_id = intval( $object->term_id ); |