Automattic\WooCommerce\Blocks\BlockTypes

ProductGalleryLargeImageNextPrevious::get_outside_button()protectedWC 1.0

Returns an HTML button element with an SVG icon for the previous or next button when the buttons are outside the image.

Method of the class: ProductGalleryLargeImageNextPrevious{}

No Hooks.

Return

String. The HTML for the button element.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_outside_button( $button_type, $context );
$button_type(string) (required)
The type of button to return. Either "previous" or "next".
$context(string) (required)
The context in which the button is being used.

ProductGalleryLargeImageNextPrevious::get_outside_button() code WC 9.6.1

protected function get_outside_button( $button_type, $context ) {
	$next_button_icon_path     = 'M1 1.28516L8 8.28516L1 15.2852';
	$previous_button_icon_path = 'M9 1.28516L2 8.28516L9 15.2852';
	$icon_path                 = $previous_button_icon_path;
	$button_side_class         = 'left';

	if ( 'next' === $button_type ) {
		$icon_path         = $next_button_icon_path;
		$button_side_class = 'right';
	}

	return sprintf(
		'<button
			data-wc-bind--disabled="state.disable%1$s"
			class="wc-block-product-gallery-large-image-next-previous--button wc-block-product-gallery-large-image-next-previous-%2$s--%3$s"
		>
			<svg
				width="10"
				height="16"
				viewBox="0 0 10 16"
				fill="none"
				xmlns="http://www.w3.org/2000/svg"
			>
				<path
					d="%4$s"
					stroke="black"
					stroke-width="1.5"
				/>
			</svg>
		</button>',
		ucfirst( $button_side_class ),
		$button_side_class,
		$this->get_class_suffix( $context ),
		$icon_path
	);
}