Automattic\WooCommerce\Internal\EmailEditor

WooContentProcessor::prepare_css │ public │ WC 10.8.0

Filter CSS for the email. The CSS from the email editor was already inlined. The method hooks to woocommerce_email_styles and removes CSS rules that we don't want to apply to the email.

Typography properties (font-size, font-weight, line-height, letter-spacing) are stripped because the email editor theme controls all typography via theme.json. Leaving these in the WooCommerce CSS would override the editor's heading sizes and weights.

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

Хуков нет.

Возвращает

string.

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

$WooContentProcessor = new WooContentProcessor();
$WooContentProcessor->prepare_css( $css ): string;
$css(строка) (обязательный)
CSS.

Список изменений

С версии 10.8.0 Введена.

Код WooContentProcessor::prepare_css() WC 11.2.2

public function prepare_css( string $css ): string {
	remove_filter( 'woocommerce_email_styles', array( $this, 'prepare_css' ) );
	// Remove typography declarations from WooCommerce CSS.
	// The email editor theme.json controls all typography; WC CSS would override it.
	return (string) preg_replace(
		array(
			'/color\s*:\s*[^;]+;/',
			'/font-family\s*:\s*[^;]+;/',
			'/font-size\s*:\s*[^;]+;/',
			'/font-weight\s*:\s*[^;]+;/',
			'/line-height\s*:\s*[^;]+;/',
			'/letter-spacing\s*:\s*[^;]+;/',
		),
		'',
		$css
	);
}