Changeset 45810
- Timestamp:
- 08/15/2019 08:03:18 PM (6 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r45807 r45810 103 103 * Optional. An array of arguments used to handle the registered field. 104 104 * 105 * @type string|array|null $get_callback Optional. The callback function used to retrieve the field106 * value. Default is 'null', the field will not be returned in107 * the response.108 * @type string|array|null $update_callback Optional. The callback function used to set and update the109 * field value. Default is 'null', the value cannot be set or110 * updated.111 * @type string|array|null $schema Optional. The callback function used to create the schema for112 * this field.Default is 'null', no schema entry will be returned.105 * @type callable|null $get_callback Optional. The callback function used to retrieve the field value. Default is 106 * 'null', the field will not be returned in the response. The function will 107 * be passed the prepared object data. 108 * @type callable|null $update_callback Optional. The callback function used to set and update the field value. Default 109 * is 'null', the value cannot be set or updated. The function will be passed 110 * the model object, like WP_Post. 111 * @type array|null $schema Optional. The callback function used to create the schema for this field. 112 * Default is 'null', no schema entry will be returned. 113 113 * } 114 114 */ -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
r45706 r45810 373 373 * @since 4.7.0 374 374 * 375 * @param array $ object Data object.376 * @param WP_REST_Request $request Full details about the request.375 * @param array $prepared Prepared response array. 376 * @param WP_REST_Request $request Full details about the request. 377 377 * @return array Modified data object with additional fields. 378 378 */ 379 protected function add_additional_fields_to_object( $ object, $request ) {379 protected function add_additional_fields_to_object( $prepared, $request ) { 380 380 381 381 $additional_fields = $this->get_additional_fields(); … … 393 393 } 394 394 395 $ object[ $field_name ] = call_user_func( $field_options['get_callback'], $object, $field_name, $request, $this->get_object_type() );396 } 397 398 return $ object;395 $prepared[ $field_name ] = call_user_func( $field_options['get_callback'], $prepared, $field_name, $request, $this->get_object_type() ); 396 } 397 398 return $prepared; 399 399 } 400 400 … … 404 404 * @since 4.7.0 405 405 * 406 * @param array $object Data Object.406 * @param object $object Data model like WP_Term or WP_Post. 407 407 * @param WP_REST_Request $request Full details about the request. 408 408 * @return bool|WP_Error True on success, WP_Error object if a field cannot be updated.
Note: See TracChangeset
for help on using the changeset viewer.