Automattic\WooCommerce\Blocks\BlockTypes

ProductImage::render_anchor()privateWC 1.0

Render anchor.

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

Хуков нет.

Возвращает

Строку.

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

// private - только в коде основоного (родительского) класса
$result = $this->render_anchor( $product, $on_sale_badge, $product_image, $attributes );
$product(\WC_Product) (обязательный)
Product object.
$on_sale_badge(строка) (обязательный)
Return value from $render_image.
$product_image(строка) (обязательный)
Return value from $render_on_sale_badge.
$attributes(массив) (обязательный)
Attributes.

Код ProductImage::render_anchor() WC 8.7.0

private function render_anchor( $product, $on_sale_badge, $product_image, $attributes ) {
	$product_permalink = $product->get_permalink();

	$pointer_events = false === $attributes['showProductLink'] ? 'pointer-events: none;' : '';

	return sprintf(
		'<a href="%1$s" style="%2$s">%3$s %4$s</a>',
		$product_permalink,
		$pointer_events,
		$on_sale_badge,
		$product_image
	);
}