WC_REST_Data_Continents_Controller::prepare_item_for_response()
Prepare the data object for response.
Метод класса: WC_REST_Data_Continents_Controller{}
Хуки из метода
Возвращает
WP_REST_Response
. $response Response data.
Использование
$WC_REST_Data_Continents_Controller = new WC_REST_Data_Continents_Controller(); $WC_REST_Data_Continents_Controller->prepare_item_for_response( $item, $request );
- $item(объект) (обязательный)
- Data object.
- $request(WP_REST_Request) (обязательный)
- Request object.
Список изменений
С версии 3.5.0 | Введена. |
Код WC_REST_Data_Continents_Controller::prepare_item_for_response() WC REST Data Continents Controller::prepare item for response WC 9.2.3
public function prepare_item_for_response( $item, $request ) { $data = $this->add_additional_fields_to_object( $item, $request ); $data = $this->filter_response_by_context( $data, 'view' ); $response = rest_ensure_response( $data ); $response->add_links( $this->prepare_links( $item ) ); /** * Filter the location list returned from the API. * * Allows modification of the location data right before it is returned. * * @param WP_REST_Response $response The response object. * @param array $item The original list of continent(s), countries, and states. * @param WP_REST_Request $request Request used to generate the response. */ return apply_filters( 'woocommerce_rest_prepare_data_continent', $response, $item, $request ); }