WC_REST_CRUD_Controller::prepare_object_for_response()
Prepares the object for the REST response.
Method of the class: WC_REST_CRUD_Controller{}
No Hooks.
Return
WP_Error|WP_REST_Response
. Response object on success, or WP_Error object on failure.
Usage
// protected - for code of main (parent) or child class $result = $this->prepare_object_for_response( $object, $request );
- $object(WC_Data) (required)
- Object data.
- $request(WP_REST_Request) (required)
- Request object.
Changelog
Since 3.0.0 | Introduced. |
WC_REST_CRUD_Controller::prepare_object_for_response() WC REST CRUD Controller::prepare object for response code WC 9.8.1
protected function prepare_object_for_response( $object, $request ) { // translators: %s: Class method name. return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) ); }