Automattic\WooCommerce\Blocks\BlockTypes
ProductGallery::get_aspect_ratio_style
Get the gallery aspect ratio CSS variables.
Method of the class: ProductGallery{}
No Hooks.
Returns
string.
Usage
// private - for code of main (parent) class only $result = $this->get_aspect_ratio_style( $block );
- $block(WP_Block) (required)
- The Product Gallery block.
ProductGallery::get_aspect_ratio_style() ProductGallery::get aspect ratio style code WC 11.3.0
private function get_aspect_ratio_style( $block ) {
$aspect_ratio = $this->parse_aspect_ratio(
$this->resolve_product_image_aspect_ratio( $block )
);
return sprintf(
'--wc-block-product-gallery-large-image-ratio-width:%1$s;' .
'--wc-block-product-gallery-large-image-ratio-height:%2$s;',
$aspect_ratio['width'],
$aspect_ratio['height']
);
}