Automattic\WooCommerce\StoreApi\Schemas\V1

ProductSchema::get_images │ protected │ WC 1.0

Get list of product images.

Метод класса: ProductSchema{}

Хуков нет.

Возвращает

array.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_images( $product );
$product(WC_Product) (обязательный)
Product instance.

Код ProductSchema::get_images() WC 11.2.2

protected function get_images( \WC_Product $product ) {
	$attachment_ids = array_filter( array_merge( [ $product->get_image_id() ], $product->get_gallery_image_ids() ) );
	if ( ! empty( $attachment_ids ) ) {
		// Prime caches to reduce future queries.
		_prime_post_caches( $attachment_ids );
	}

	return array_values( array_filter( array_map( [ $this->image_attachment_schema, 'get_item_response' ], $attachment_ids ) ) );
}