Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce\Renderer\Blocks

Product_Image::wrap_with_linkprivateWC 1.0

Wrap image with product link.

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

Хуков нет.

Возвращает

Строку.

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

// private - только в коде основоного (родительского) класса
$result = $this->wrap_with_link( $image_html, $product ): string;
$image_html(строка) (обязательный)
Image HTML.
$product(WC_Product) (обязательный)
Product object.

Код Product_Image::wrap_with_link() WC 10.4.3

private function wrap_with_link( string $image_html, \WC_Product $product ): string {
	$product_url = $product->get_permalink();

	return sprintf(
		'<a href="%s" style="display: block; text-decoration: none;">%s</a>',
		esc_url( $product_url ),
		$image_html
	);
}