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

Group::remove_horizontal_paddingprivateWC 1.0

Remove horizontal padding properties from compiled cell styles.

Used when suppress-horizontal-padding is set to prevent the group from applying its own horizontal padding (which has been distributed per-block by the Spacing_Preprocessor).

Method of the class: Group{}

No Hooks.

Returns

Array. Styles with horizontal padding removed.

Usage

// private - for code of main (parent) class only
$result = $this->remove_horizontal_padding( $cell_styles ): array;
$cell_styles(array) (required)
The compiled cell styles from Styles_Helper::get_block_styles().

Group::remove_horizontal_padding() code WC 10.8.1

private function remove_horizontal_padding( array $cell_styles ): array {
	if ( ! isset( $cell_styles['declarations'] ) || ! is_array( $cell_styles['declarations'] ) ) {
		return $cell_styles;
	}

	unset(
		$cell_styles['declarations']['padding-left'],
		$cell_styles['declarations']['padding-right']
	);

	// Rebuild CSS string from remaining declarations.
	return Styles_Helper::extend_block_styles( $cell_styles, array() );
}