Automattic\WooCommerce\Blocks\BlockTypes

ProductGalleryLargeImage::get_zoom_directives()privateWC 1.0

Get directives for zoom.

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

Хуков нет.

Возвращает

Массив.

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

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

Код ProductGalleryLargeImage::get_zoom_directives() WC 9.6.0

private function get_zoom_directives( $block_context ) {
	if ( ! $block_context['hoverZoom'] ) {
		return array();
	}
	$context = array(
		'styles' => array(
			'transform'        => 'scale(1.0)',
			'transform-origin' => '',
		),
	);

	return array(
		'data-wc-interactive'    => wp_json_encode( array( 'namespace' => 'woocommerce/product-gallery' ), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ),
		'data-wc-context'        => wp_json_encode( $context, JSON_NUMERIC_CHECK | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ),
		'data-wc-on--mousemove'  => 'actions.startZoom',
		'data-wc-on--mouseleave' => 'actions.resetZoom',
	);
}