WC_REST_System_Status_Tools_V2_Controller::get_item()
Return a single tool.
Метод класса: WC_REST_System_Status_Tools_V2_Controller{}
Хуков нет.
Возвращает
WP_Error|WP_REST_Response
.
Использование
$WC_REST_System_Status_Tools_V2_Controller = new WC_REST_System_Status_Tools_V2_Controller(); $WC_REST_System_Status_Tools_V2_Controller->get_item( $request );
- $request(WP_REST_Request) (обязательный)
- Request data.
Код WC_REST_System_Status_Tools_V2_Controller::get_item() WC REST System Status Tools V2 Controller::get item WC 8.7.0
public function get_item( $request ) { $tools = $this->get_tools(); if ( empty( $tools[ $request['id'] ] ) ) { return new WP_Error( 'woocommerce_rest_system_status_tool_invalid_id', __( 'Invalid tool ID.', 'woocommerce' ), array( 'status' => 404 ) ); } $tool = $tools[ $request['id'] ]; return rest_ensure_response( $this->prepare_item_for_response( array( 'id' => $request['id'], 'name' => $tool['name'], 'action' => $tool['button'], 'description' => $tool['desc'], ), $request ) ); }