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

Product_Image::wrap_with_linkprivateWC 1.0

Wrap image with product link.

Method of the class: Product_Image{}

No Hooks.

Returns

String.

Usage

// private - for code of main (parent) class only
$result = $this->wrap_with_link( $image_html, $product ): string;
$image_html(string) (required)
Image HTML.
$product(WC_Product) (required)
Product object.

Product_Image::wrap_with_link() code WC 10.5.0

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
	);
}