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

Table::add_header_footer_bordersprivateWC 1.0

Add thicker borders for table headers and footers when no custom border is set.

Метод класса: Table{}

Хуков нет.

Возвращает

Строку. Updated cell styles.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->add_header_footer_borders( $html, $base_styles, $border_color, $current_section, ?string $custom_border_width ): string;
$html(WP_HTML_Tag_Processor) (обязательный)
HTML tag processor.
$base_styles(строка) (обязательный)
Base cell styles.
$border_color(строка) (обязательный)
Border color.
$current_section(строка)
Current table section (thead, tbody, tfoot).
По умолчанию: ''
?string $custom_border_width
.
По умолчанию: null

Код Table::add_header_footer_borders() 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;
}