Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce\Renderer\Blocks
Product_Sale_Badge::apply_email_wrapper
Apply email-compatible table wrapper.
Метод класса: Product_Sale_Badge{}
Хуков нет.
Возвращает
string.
Использование
// private - только в коде основоного (родительского) класса $result = $this->apply_email_wrapper( $badge_html, $parsed_block, $rendering_context ): string;
- $badge_html(строка) (обязательный)
- Badge HTML.
- $parsed_block(массив) (обязательный)
- Parsed block.
- $rendering_context(Rendering_Context) (обязательный)
- Rendering context.
Код Product_Sale_Badge::apply_email_wrapper() Product Sale Badge::apply email wrapper WC 11.2.2
private function apply_email_wrapper( string $badge_html, array $parsed_block, Rendering_Context $rendering_context ): string {
$align = $rendering_context->resolve_text_align( $parsed_block['attrs']['align'] ?? null );
$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 );
}