Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors
Blocks_Width_Preprocessor::preprocess
Method to preprocess the content before rendering
Method of the class: Blocks_Width_Preprocessor{}
No Hooks.
Returns
Array.
Usage
$Blocks_Width_Preprocessor = new Blocks_Width_Preprocessor(); $Blocks_Width_Preprocessor->preprocess( $parsed_blocks, $layout, $styles ): array;
- $parsed_blocks(array) (required)
- Parsed blocks of the email.
- $layout(array) (required)
- .
- $styles(array) (required)
- .
Blocks_Width_Preprocessor::preprocess() Blocks Width Preprocessor::preprocess code WC 10.9.1
public function preprocess( array $parsed_blocks, array $layout, array $styles ): array {
// Root padding is distributed to individual blocks by Spacing_Preprocessor
// (which runs before this preprocessor). Zero it out here so we don't
// double-subtract: each block's width is reduced only if the block
// actually received root-padding-left/right in its email_attrs.
$variables_map = $styles['__variables_map'] ?? array();
$styles['spacing']['padding']['left'] = '0px';
$styles['spacing']['padding']['right'] = '0px';
return $this->calculate_widths( $parsed_blocks, $layout, $styles, $variables_map );
}