- Timestamp:
- 01/19/2023 09:46:58 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php
r54891 r55102 3299 3299 } 3300 3300 3301 public function additional_field_get_callback( $object ) {3302 return get_comment_meta( $object['id'], 'my_custom_int', true );3303 } 3304 3305 public function additional_field_update_callback( $value, $comment ) {3301 public function additional_field_get_callback( $object, $field_name ) { 3302 return get_comment_meta( $object['id'], $field_name, true ); 3303 } 3304 3305 public function additional_field_update_callback( $value, $comment, $field_name ) { 3306 3306 if ( 'returnError' === $value ) { 3307 3307 return new WP_Error( 'rest_invalid_param', 'Testing an error.', array( 'status' => 400 ) ); 3308 3308 } 3309 update_comment_meta( $comment->comment_ID, 'my_custom_int', $value );3309 update_comment_meta( $comment->comment_ID, $field_name, $value ); 3310 3310 } 3311 3311
Note: See TracChangeset
for help on using the changeset viewer.