WC_REST_System_Status_Tools_V2_Controller::prepare_item_for_response()
Prepare a tool item for serialization.
Метод класса: WC_REST_System_Status_Tools_V2_Controller{}
Хуков нет.
Возвращает
WP_REST_Response
. $response Response data.
Использование
$WC_REST_System_Status_Tools_V2_Controller = new WC_REST_System_Status_Tools_V2_Controller(); $WC_REST_System_Status_Tools_V2_Controller->prepare_item_for_response( $item, $request );
- $item(массив) (обязательный)
- Object.
- $request(WP_REST_Request) (обязательный)
- Request object.
Код WC_REST_System_Status_Tools_V2_Controller::prepare_item_for_response() WC REST System Status Tools V2 Controller::prepare item for response WC 9.3.3
public function prepare_item_for_response( $item, $request ) { $context = empty( $request['context'] ) ? 'view' : $request['context']; $data = $this->add_additional_fields_to_object( $item, $request ); $data = $this->filter_response_by_context( $data, $context ); $response = rest_ensure_response( $data ); $response->add_links( $this->prepare_links( $item['id'] ) ); return $response; }