WC_REST_Data_Controller::get_items()
Return the list of data resources.
Method of the class: WC_REST_Data_Controller{}
No Hooks.
Return
WP_Error|WP_REST_Response
.
Usage
$WC_REST_Data_Controller = new WC_REST_Data_Controller(); $WC_REST_Data_Controller->get_items( $request );
- $request(WP_REST_Request) (required)
- Request data.
Changelog
Since 3.5.0 | Introduced. |
WC_REST_Data_Controller::get_items() WC REST Data Controller::get items code WC 9.5.1
public function get_items( $request ) { $data = array(); $resources = array( array( 'slug' => 'continents', 'description' => __( 'List of supported continents, countries, and states.', 'woocommerce' ), ), array( 'slug' => 'countries', 'description' => __( 'List of supported states in a given country.', 'woocommerce' ), ), array( 'slug' => 'currencies', 'description' => __( 'List of supported currencies.', 'woocommerce' ), ), ); foreach ( $resources as $resource ) { $item = $this->prepare_item_for_response( (object) $resource, $request ); $data[] = $this->prepare_response_for_collection( $item ); } return rest_ensure_response( $data ); }