Automattic\WooCommerce\Blocks\BlockTypes

ProductGalleryLargeImageNextPrevious::get_button()protectedWC 1.0

Generates the HTML for a next or previous button for the product gallery large image.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_button( $button_type );
$button_type(строка) (обязательный)
The type of button to generate. Either 'previous' or 'next'.

Код ProductGalleryLargeImageNextPrevious::get_button() WC 9.8.5

protected function get_button( $button_type ) {
	$previous_button_icon_path = 'M28.1 12L30.5 14L21.3 24L30.5 34L28.1 36L17.3 24L28.1 12Z';
	$next_button_icon_path     = 'M21.7001 12L19.3 14L28.5 24L19.3 34L21.7001 36L32.5 24L21.7001 12Z';
	$icon_path                 = $previous_button_icon_path;
	$button_side_class         = 'left';
	$button_disabled_directive = 'context.disableLeft';

	if ( 'next' === $button_type ) {
		$icon_path                 = $next_button_icon_path;
		$button_side_class         = 'right';
		$button_disabled_directive = 'context.disableRight';
	}

	return sprintf(
		'<button
			data-wp-bind--disabled="%1$s"
			class="wc-block-product-gallery-large-image-next-previous--button wc-block-product-gallery-large-image-next-previous-%2$s"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="49" height="48" viewBox="0 0 49 48" fill="none">
				<g filter="url(#filter0_b_397_11354)">
					<rect x="0.5" width="48" height="48" rx="5" fill="black" fill-opacity="0.5"/>
					<path d="%3$s" fill="white"/>
				</g>
				<defs>
					<filter id="filter0_b_397_11354" x="-9.5" y="-10" width="68" height="68" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
						<feFlood flood-opacity="0" result="BackgroundImageFix"/>
						<feGaussianBlur in="BackgroundImageFix" stdDeviation="5"/>
						<feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur_397_11354"/>
						<feBlend mode="normal" in="SourceGraphic" in2="effect1_backgroundBlur_397_11354" result="shape"/>
					</filter>
				</defs>
			</svg>
		</button>',
		$button_disabled_directive,
		$button_side_class,
		$icon_path
	);
}