WC_REST_Setting_Options_V2_Controller::prepare_item_for_response()
Prepare a single setting object for response.
Метод класса: WC_REST_Setting_Options_V2_Controller{}
Хуков нет.
Возвращает
WP_REST_Response
. $response Response data.
Использование
$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(объект) (обязательный)
- Setting object.
- $request(WP_REST_Request) (обязательный)
- Request object.
Список изменений
С версии 3.0.0 | Введена. |
Код WC_REST_Setting_Options_V2_Controller::prepare_item_for_response() WC REST Setting Options V2 Controller::prepare item for response WC 9.3.3
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; }