Automattic\WooCommerce\StoreApi\Schemas\V1
ProductAttributeSchema::get_item_response
Convert an attribute object into an object suitable for the response.
Метод класса: ProductAttributeSchema{}
Хуков нет.
Возвращает
Массив.
Использование
$ProductAttributeSchema = new ProductAttributeSchema(); $ProductAttributeSchema->get_item_response( $attribute );
- $attribute(объект) (обязательный)
- Attribute object.
Код ProductAttributeSchema::get_item_response() ProductAttributeSchema::get item response WC 11.0.0
public function get_item_response( $attribute ) {
return [
'id' => (int) $attribute->id,
'name' => $this->prepare_html_response( $attribute->name ),
'taxonomy' => $attribute->slug,
'type' => $attribute->type,
'order' => $attribute->order_by,
'has_archives' => $attribute->has_archives,
'count' => (int) \wp_count_terms( $attribute->slug ),
];
}