Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors
Blocks_Width_Preprocessor::preprocess
Method to preprocess the content before rendering
Метод класса: Blocks_Width_Preprocessor{}
Хуков нет.
Возвращает
array.
Использование
$Blocks_Width_Preprocessor = new Blocks_Width_Preprocessor(); $Blocks_Width_Preprocessor->preprocess( $parsed_blocks, $layout, $styles ): array;
- $parsed_blocks(массив) (обязательный)
- Parsed blocks of the email.
- $layout(array{contentSize: string}) (обязательный)
- Layout of the email.
- $styles(массив) (обязательный)
- .
Код Blocks_Width_Preprocessor::preprocess() Blocks Width Preprocessor::preprocess WC 11.1.0
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 );
}