WC_REST_Data_Continents_Controller::get_items() public WC 3.5.0
Return the list of states for all continents.
{} It's a method of the class: WC_REST_Data_Continents_Controller{}
No Hooks.
Return
WP_Error|WP_REST_Response.
Usage
$WC_REST_Data_Continents_Controller = new WC_REST_Data_Continents_Controller(); $WC_REST_Data_Continents_Controller->get_items( $request );
- $request(WP_REST_Request) (required)
- Request data.
Changelog
Since 3.5.0 | Introduced. |
Code of WC_REST_Data_Continents_Controller::get_items() WC REST Data Continents Controller::get items WC 5.0.0
public function get_items( $request ) {
$continents = WC()->countries->get_continents();
$data = array();
foreach ( array_keys( $continents ) as $continent_code ) {
$continent = $this->get_continent( $continent_code, $request );
$response = $this->prepare_item_for_response( $continent, $request );
$data[] = $this->prepare_response_for_collection( $response );
}
return rest_ensure_response( $data );
}