@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | $fields = array(); |
74 | 74 | foreach ( $this->rest_box->cmb->prop( 'fields', array() ) as $field ) { |
75 | - $field_id = $field['id']; |
|
75 | + $field_id = $field[ 'id' ]; |
|
76 | 76 | $rest_field = $this->get_rest_field( $field_id ); |
77 | 77 | |
78 | 78 | if ( ! is_wp_error( $rest_field ) ) { |
79 | - $fields[ $field_id ] = $this->server->response_to_data( $rest_field, isset( $this->request['_embed'] ) ); |
|
79 | + $fields[ $field_id ] = $this->server->response_to_data( $rest_field, isset( $this->request[ '_embed' ] ) ); |
|
80 | 80 | } else { |
81 | 81 | $fields[ $field_id ] = array( 'error' => $rest_field->get_error_message() ); |
82 | 82 | } |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | public function update_field_value( $request ) { |
121 | 121 | $this->initiate_rest_read_box( $request, 'field_value_update' ); |
122 | 122 | |
123 | - if ( ! $this->request['object_id'] && ! $this->request['object_type'] ) { |
|
123 | + if ( ! $this->request[ 'object_id' ] && ! $this->request[ 'object_type' ] ) { |
|
124 | 124 | return $this->prepare_item( array( 'error' => __( 'CMB2 Field value cannot be updated without the object_id and object_type parameters specified.', 'cmb2' ) ) ); |
125 | 125 | } |
126 | 126 | |
127 | - if ( ! $this->request['value'] ) { |
|
127 | + if ( ! $this->request[ 'value' ] ) { |
|
128 | 128 | return $this->prepare_item( array( 'error' => __( 'CMB2 Field value cannot be updated without the value parameter specified.', 'cmb2' ) ) ); |
129 | 129 | } |
130 | 130 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | return new WP_Error( 'cmb2_rest_error', __( 'No field found by that id.', 'cmb2' ) ); |
139 | 139 | } |
140 | 140 | |
141 | - $field->args['value_updated'] = (bool) $field->save_field( $this->request['value'] ); |
|
141 | + $field->args[ 'value_updated' ] = (bool) $field->save_field( $this->request[ 'value' ] ); |
|
142 | 142 | |
143 | 143 | $field_data = $this->get_rest_field( $field ); |
144 | 144 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public function delete_field_value( $request ) { |
161 | 161 | $this->initiate_rest_read_box( $request, 'field_value_delete' ); |
162 | 162 | |
163 | - if ( ! $this->request['object_id'] && ! $this->request['object_type'] ) { |
|
163 | + if ( ! $this->request[ 'object_id' ] && ! $this->request[ 'object_type' ] ) { |
|
164 | 164 | return $this->prepare_item( array( 'error' => __( 'CMB2 Field value cannot be deleted without the object_id and object_type parameters specified.', 'cmb2' ) ) ); |
165 | 165 | } |
166 | 166 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | return new WP_Error( 'cmb2_rest_error', __( 'No field found by that id.', 'cmb2' ) ); |
175 | 175 | } |
176 | 176 | |
177 | - $field->args['value_deleted'] = (bool) $field->remove_data(); |
|
177 | + $field->args[ 'value_deleted' ] = (bool) $field->remove_data(); |
|
178 | 178 | |
179 | 179 | $field_data = $this->get_rest_field( $field ); |
180 | 180 | |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | $value = $field->options(); |
243 | 243 | } elseif ( in_array( $key, CMB2_Field::$callable_fields, true ) ) { |
244 | 244 | |
245 | - if ( isset( $this->request['_rendered'] ) ) { |
|
245 | + if ( isset( $this->request[ '_rendered' ] ) ) { |
|
246 | 246 | $value = $key === 'render_row_cb' ? $rendered : $field->get_param_callback_result( $key ); |
247 | 247 | } elseif ( is_array( $value ) ) { |
248 | 248 | // We need to rewrite callbacks as string as they will cause |
249 | 249 | // JSON recursion errors. |
250 | - $class = is_string( $value[0] ) ? $value[0] : get_class( $value[0] ); |
|
251 | - $value = $class . '::' . $value[1]; |
|
250 | + $class = is_string( $value[ 0 ] ) ? $value[ 0 ] : get_class( $value[ 0 ] ); |
|
251 | + $value = $class . '::' . $value[ 1 ]; |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | - if ( $this->request['object_id'] && $this->request['object_type'] ) { |
|
265 | - $field_data['value'] = $field->get_data(); |
|
264 | + if ( $this->request[ 'object_id' ] && $this->request[ 'object_type' ] ) { |
|
265 | + $field_data[ 'value' ] = $field->get_data(); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | return $field_data; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | // Don't embed boxes when looking at boxes route. |
297 | 297 | if ( '/cmb2/v1/boxes' !== CMB2_REST_Controller::get_intial_route() ) { |
298 | - $links['up']['embeddable'] = true; |
|
298 | + $links[ 'up' ][ 'embeddable' ] = true; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | return $links; |