Automattic\WooCommerce\Blocks\BlockTypes

ProductGallery::get_aspect_ratio_styleprivateWC 1.0

Get the gallery aspect ratio CSS variables.

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

Хуков нет.

Возвращает

string.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_aspect_ratio_style( $block );
$block(WP_Block) (обязательный)
The Product Gallery block.

Код ProductGallery::get_aspect_ratio_style() WC 11.1.2

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']
	);
}