Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks
Table::add_header_footer_borders
Add thicker borders for table headers and footers when no custom border is set.
Method of the class: Table{}
No Hooks.
Returns
String. Updated cell styles.
Usage
// private - for code of main (parent) class only $result = $this->add_header_footer_borders( $html, $base_styles, $border_color, $current_section, ?string $custom_border_width ): string;
- $html(WP_HTML_Tag_Processor) (required)
- HTML tag processor.
- $base_styles(string) (required)
- Base cell styles.
- $border_color(string) (required)
- Border color.
- $current_section(string)
- Current table section (thead, tbody, tfoot).
Default:'' - ?string $custom_border_width
- .
Default:null
Table::add_header_footer_borders() Table::add header footer borders code WC 10.4.3
private function add_header_footer_borders( \WP_HTML_Tag_Processor $html, string $base_styles, string $border_color, string $current_section = '', ?string $custom_border_width = null ): string {
$tag_name = $html->get_tag();
// Only add thicker borders if no custom border width is set.
if ( $custom_border_width ) {
return $base_styles;
}
// Add thicker bottom border to all TH elements (headers).
if ( 'TH' === $tag_name ) {
$base_styles .= " border-bottom: 3px solid {$border_color};";
}
// Add thicker top border to footer cells (TD elements in tfoot).
if ( 'TD' === $tag_name && 'tfoot' === $current_section ) {
$base_styles .= " border-top: 3px solid {$border_color};";
}
return $base_styles;
}