@@ -202,7 +202,7 @@ |
||
| 202 | 202 | * |
| 203 | 203 | * @since 2.2.4 |
| 204 | 204 | * |
| 205 | - * @param mixed $value The value of the field |
|
| 205 | + * @param mixed $values The value of the field |
|
| 206 | 206 | * @param object $object The object from the response |
| 207 | 207 | * @param string $field_name Name of field |
| 208 | 208 | * |
@@ -126,18 +126,18 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | protected function declare_read_edit_fields() { |
| 128 | 128 | foreach ( $this->cmb->prop( 'fields' ) as $field ) { |
| 129 | - $show_in_rest = isset( $field['show_in_rest'] ) ? $field['show_in_rest'] : null; |
|
| 129 | + $show_in_rest = isset( $field[ 'show_in_rest' ] ) ? $field[ 'show_in_rest' ] : null; |
|
| 130 | 130 | |
| 131 | 131 | if ( false === $show_in_rest ) { |
| 132 | 132 | continue; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if ( $this->can_read( $show_in_rest ) ) { |
| 136 | - $this->read_fields[] = $field['id']; |
|
| 136 | + $this->read_fields[ ] = $field[ 'id' ]; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if ( $this->can_edit( $show_in_rest ) ) { |
| 140 | - $this->edit_fields[] = $field['id']; |
|
| 140 | + $this->edit_fields[ ] = $field[ 'id' ]; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | } |
@@ -176,14 +176,14 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public static function get_restable_field_values( $data, $field_name, $request ) { |
| 178 | 178 | $values = array(); |
| 179 | - if ( ! isset( $data['id'] ) ) { |
|
| 179 | + if ( ! isset( $data[ 'id' ] ) ) { |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | foreach ( self::$boxes as $cmb_id => $rest_box ) { |
| 184 | 184 | foreach ( $rest_box->read_fields as $field_id ) { |
| 185 | 185 | $field = $rest_box->cmb->get_field( $field_id ); |
| 186 | - $field->object_id( $data['id'] ); |
|
| 186 | + $field->object_id( $data[ 'id' ] ); |
|
| 187 | 187 | |
| 188 | 188 | // TODO: test other object types (users, comments, etc) |
| 189 | 189 | // if ( isset( $data['type'] ) ) { |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | continue; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - $rest_box->cmb->object_id( $data['object_id'] ); |
|
| 229 | - $rest_box->cmb->object_type( $data['object_type'] ); |
|
| 228 | + $rest_box->cmb->object_id( $data[ 'object_id' ] ); |
|
| 229 | + $rest_box->cmb->object_type( $data[ 'object_type' ] ); |
|
| 230 | 230 | |
| 231 | 231 | // TODO: Test since refactor. |
| 232 | 232 | $updated[ $cmb_id ] = $rest_box->sanitize_box_values( $values ); |
@@ -334,8 +334,8 @@ discard block |
||
| 334 | 334 | } elseif ( isset( $object->comment_ID ) ) { |
| 335 | 335 | $object_id = intval( $object->comment_ID ); |
| 336 | 336 | $object_type = 'comment'; |
| 337 | - } elseif ( is_array( $object ) && isset( $object['term_id'] ) ) { |
|
| 338 | - $object_id = intval( $object['term_id'] ); |
|
| 337 | + } elseif ( is_array( $object ) && isset( $object[ 'term_id' ] ) ) { |
|
| 338 | + $object_id = intval( $object[ 'term_id' ] ); |
|
| 339 | 339 | $object_type = 'term'; |
| 340 | 340 | } elseif ( isset( $object->term_id ) ) { |
| 341 | 341 | $object_id = intval( $object->term_id ); |