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

Product_Price::apply_email_wrapperprivateWC 1.0

Apply email-compatible table wrapper.

Method of the class: Product_Price{}

No Hooks.

Returns

String.

Usage

// private - for code of main (parent) class only
$result = $this->apply_email_wrapper( $price_html, $parsed_block ): string;
$price_html(string) (required)
Price HTML.
$parsed_block(array) (required)
Parsed block.

Product_Price::apply_email_wrapper() code WC 10.5.0

private function apply_email_wrapper( string $price_html, array $parsed_block ): string {
	$align = $parsed_block['attrs']['textAlign'] ?? 'left';

	$wrapper_styles = array(
		'border-collapse' => 'collapse',
		'width'           => '100%',
	);

	$cell_styles = array(
		'padding'     => '5px 0',
		'text-align'  => $align,
		'font-family' => 'inherit',
	);

	$table_attrs = array(
		'style' => \WP_Style_Engine::compile_css( $wrapper_styles, '' ),
		'width' => '100%',
	);

	$cell_attrs = array(
		'class' => 'email-product-price-cell',
		'style' => \WP_Style_Engine::compile_css( $cell_styles, '' ),
		'align' => $align,
	);

	return Table_Wrapper_Helper::render_table_wrapper( $price_html, $table_attrs, $cell_attrs );
}