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.

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

Хуков нет.

Возвращает

Строку. The HTML for the button element.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_outside_button( $button_type, $context );
$button_type(строка) (обязательный)
The type of button to return. Either "previous" or "next".
$context(строка) (обязательный)
The context in which the button is being used.

Код ProductGalleryLargeImageNextPrevious::get_outside_button() WC 9.5.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 class="wc-block-product-gallery-large-image-next-previous--button wc-block-product-gallery-large-image-next-previous-%1$s--%2$s">
			<svg
				width="10"
				height="16"
				viewBox="0 0 10 16"
				fill="none"
				xmlns="http://www.w3.org/2000/svg"
			>
				<path
					d="%3$s"
					stroke="black"
					stroke-width="1.5"
				/>
			</svg>
		</button>',
		$button_side_class,
		$this->get_class_suffix( $context ),
		$icon_path
	);
}