Automattic\WooCommerce\EmailEditor\Engine

Site_Style_Sync_Controller::convert_spacing_stylesprivateWC 1.0

Convert site spacing styles to email format

Method of the class: Site_Style_Sync_Controller{}

No Hooks.

Returns

Array. Email-compatible spacing styles.

Usage

// private - for code of main (parent) class only
$result = $this->convert_spacing_styles( $spacing_styles ): array;
$spacing_styles(array) (required)
Site spacing styles.

Site_Style_Sync_Controller::convert_spacing_styles() code WC 10.7.0

private function convert_spacing_styles( array $spacing_styles ): array {
	$email_spacing = array();

	$this->resolve_and_assign(
		$spacing_styles,
		'padding',
		$email_spacing,
		function ( $value ) {
			return $this->convert_spacing_values( $value, array( 'styles', 'spacing', 'padding' ) );
		}
	);
	$this->resolve_and_assign(
		$spacing_styles,
		'blockGap',
		$email_spacing,
		function ( $value ) {
			$fallback = $this->get_base_theme_value( array( 'styles', 'spacing', 'blockGap' ) );
			return $this->convert_to_px_size( $value, $fallback );
		}
	);

	// Note: We intentionally skip margin as it's not supported in email renderer.

	return $email_spacing;
}