Automattic\WooCommerce\Blocks\BlockTypes

ProductGalleryLargeImage::get_zoom_directives()privateWC 1.0

Get directives for zoom.

Method of the class: ProductGalleryLargeImage{}

No Hooks.

Return

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_zoom_directives( $block_context );
$block_context(array) (required)
The block context.

ProductGalleryLargeImage::get_zoom_directives() code WC 9.5.1

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