WordPress at Your Fingertips
function is not described

WC_REST_Setting_Options_V2_Controller::prepare_item_for_response() public WC 3.0.0

Prepare a single setting object for response.

{} It's a method of the class: WC_REST_Setting_Options_V2_Controller{}

No Hooks.

Return

WP_REST_Response. $response Response data.

Usage

$WC_REST_Setting_Options_V2_Controller = new WC_REST_Setting_Options_V2_Controller();
$WC_REST_Setting_Options_V2_Controller->prepare_item_for_response( $item, $request );
$item(object) (required)
Setting object.
$request(WP_REST_Request) (required)
Request object.

Changelog

Since 3.0.0 Introduced.

Code of WC_REST_Setting_Options_V2_Controller::prepare_item_for_response() WC 5.9.0

public function prepare_item_for_response( $item, $request ) {
	unset( $item['option_key'] );
	$data     = $this->filter_setting( $item );
	$data     = $this->add_additional_fields_to_object( $data, $request );
	$data     = $this->filter_response_by_context( $data, empty( $request['context'] ) ? 'view' : $request['context'] );
	$response = rest_ensure_response( $data );
	$response->add_links( $this->prepare_links( $data['id'], $request['group_id'] ) );
	return $response;
}