WC_REST_System_Status_Tools_V2_Controller::get_item
Return a single tool.
Method of the class: WC_REST_System_Status_Tools_V2_Controller{}
No Hooks.
Returns
WP_Error|WP_REST_Response.
Usage
$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) (required)
- Request data.
WC_REST_System_Status_Tools_V2_Controller::get_item() WC REST System Status Tools V2 Controller::get item code WC 10.8.1
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
)
);
}