Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce\Renderer\Blocks
Product_Sale_Badge::apply_email_wrapper
Apply email-compatible table wrapper.
Method of the class: Product_Sale_Badge{}
No Hooks.
Returns
String.
Usage
// private - for code of main (parent) class only $result = $this->apply_email_wrapper( $badge_html, $parsed_block ): string;
- $badge_html(string) (required)
- Badge HTML.
- $parsed_block(array) (required)
- Parsed block.
Product_Sale_Badge::apply_email_wrapper() Product Sale Badge::apply email wrapper code WC 10.5.0
private function apply_email_wrapper( string $badge_html, array $parsed_block ): string {
$align = $parsed_block['attrs']['align'] ?? 'left';
$wrapper_styles = array(
'border-collapse' => 'collapse',
'width' => '100%',
);
$cell_styles = array(
'padding' => '5px 0',
'text-align' => $align,
);
$table_attrs = array(
'style' => \WP_Style_Engine::compile_css( $wrapper_styles, '' ),
'width' => '100%',
);
$cell_attrs = array(
'class' => 'email-product-sale-badge-cell',
'style' => \WP_Style_Engine::compile_css( $cell_styles, '' ),
'align' => $align,
);
return Table_Wrapper_Helper::render_table_wrapper( $badge_html, $table_attrs, $cell_attrs );
}