Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors

Spacing_Preprocessor::has_zero_horizontal_paddingprivateWC 1.0

Checks whether a block explicitly sets zero horizontal padding.

Explicit zero padding (0, 0px, 0em, etc.) signals that the block intentionally wants edge-to-edge layout. Root padding should not be added on top.

Non-zero padding (e.g. 20px) is internal content spacing and does not affect root padding — both can coexist independently.

Method of the class: Spacing_Preprocessor{}

No Hooks.

Returns

true|false. True if the block explicitly sets zero horizontal padding.

Usage

// private - for code of main (parent) class only
$result = $this->has_zero_horizontal_padding( $block ): bool;
$block(array) (required)
The block to check.

Spacing_Preprocessor::has_zero_horizontal_padding() code WC 10.8.1

private function has_zero_horizontal_padding( array $block ): bool {
	$padding = $block['attrs']['style']['spacing']['padding'] ?? array();
	$left    = $padding['left'] ?? null;
	$right   = $padding['right'] ?? null;

	return $this->is_zero_value( $left ) || $this->is_zero_value( $right );
}