Automattic\WooCommerce\Blocks\Utils

ProductGalleryUtils::get_product_image_placeholder_html()public staticWC 1.0

Get the product image placeholder HTML.

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

Хуков нет.

Возвращает

Строку.

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

$result = ProductGalleryUtils::get_product_image_placeholder_html( $size, $attributes, $crop_images );
$size(строка) (обязательный)
Image size.
$attributes(массив) (обязательный)
Attributes.
$crop_images(true|false) (обязательный)
Whether to crop images.

Код ProductGalleryUtils::get_product_image_placeholder_html() WC 9.5.1

public static function get_product_image_placeholder_html( $size, $attributes, $crop_images ) {
	$placeholder_image_id = get_option( 'woocommerce_placeholder_image', 0 );

	if ( ! $placeholder_image_id ) {

		// Return default fallback WooCommerce placeholder image.
		return wc_placeholder_img( array( '', '' ), $attributes );
	}

	if ( $crop_images ) {
		self::maybe_generate_intermediate_image( $placeholder_image_id, self::CROP_IMAGE_SIZE_NAME );
	}

	return wp_get_attachment_image( $placeholder_image_id, $size, false, $attributes );
}