Automattic\WooCommerce\Blocks\Utils
ProductGalleryUtils::get_product_image_placeholder_html()
Get the product image placeholder HTML.
Method of the class: ProductGalleryUtils{}
No Hooks.
Return
String
.
Usage
$result = ProductGalleryUtils::get_product_image_placeholder_html( $size, $attributes, $crop_images );
- $size(string) (required)
- Image size.
- $attributes(array) (required)
- Attributes.
- $crop_images(true|false) (required)
- Whether to crop images.
ProductGalleryUtils::get_product_image_placeholder_html() ProductGalleryUtils::get product image placeholder html code WC 9.4.2
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 ); }