Automattic\WooCommerce\EmailEditor\Integrations\Utils

Html_Processing_Helper::is_wrapper_handled_class │ private static │ WC 1.0

Whether a single class name applies a background or border that the wrapping table cell already renders.

Method of the class: Html_Processing_Helper{}

No Hooks.

Returns

bool. True when the class should not stay on the inner element.

Usage

$result = Html_Processing_Helper::is_wrapper_handled_class( $class_name ): bool;
$class_name(string) (required)
Class name to test.

Html_Processing_Helper::is_wrapper_handled_class() code WC 11.3.0

private static function is_wrapper_handled_class( string $class_name ): bool {
	// `has-background` is added for any background. Preset palette backgrounds add
	// `has-<slug>-background-color` on top of it, which is why matching the bare name is not enough.
	if ( 'has-background' === $class_name ) {
		return true;
	}

	if ( str_starts_with( $class_name, 'has-' ) && str_ends_with( $class_name, '-background-color' ) ) {
		return true;
	}

	// Border classes, e.g. `has-border-color`, `has-<slug>-border-color`.
	return false !== strpos( $class_name, '-border-' );
}