WC_REST_Product_Attributes_V1_Controller::get_items()
Get all attributes.
Метод класса: WC_REST_Product_Attributes_V1_Controller{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_REST_Product_Attributes_V1_Controller = new WC_REST_Product_Attributes_V1_Controller(); $WC_REST_Product_Attributes_V1_Controller->get_items( $request );
- $request(WP_REST_Request) (обязательный)
- The request to get the attributes from.
Код WC_REST_Product_Attributes_V1_Controller::get_items() WC REST Product Attributes V1 Controller::get items WC 9.7.1
public function get_items( $request ) { $attributes = wc_get_attribute_taxonomies(); $data = array(); foreach ( $attributes as $attribute_obj ) { $attribute = $this->prepare_item_for_response( $attribute_obj, $request ); $attribute = $this->prepare_response_for_collection( $attribute ); $data[] = $attribute; } $response = rest_ensure_response( $data ); // This API call always returns all product attributes due to retrieval from the object cache. $response->header( 'X-WP-Total', count( $data ) ); $response->header( 'X-WP-TotalPages', 1 ); return $response; }