Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors
Cleanup_Preprocessor::preprocess
Method to preprocess the content before rendering
Метод класса: Cleanup_Preprocessor{}
Хуков нет.
Возвращает
Массив
.
Использование
$Cleanup_Preprocessor = new Cleanup_Preprocessor(); $Cleanup_Preprocessor->preprocess( $parsed_blocks, $layout, $styles ): array;
- $parsed_blocks(массив) (обязательный)
- Parsed blocks of the email.
- $layout(массив) (обязательный)
- .
- $styles(массив) (обязательный)
- .
Код Cleanup_Preprocessor::preprocess() Cleanup Preprocessor::preprocess WC 10.0.2
public function preprocess( array $parsed_blocks, array $layout, array $styles ): array { foreach ( $parsed_blocks as $key => $block ) { // https://core.trac.wordpress.org/ticket/45312 // \WP_Block_Parser::parse_blocks() sometimes add a block with name null that can cause unexpected spaces in rendered content // This behavior was reported as an issue, but it was closed as won't fix. if ( null === $block['blockName'] ) { unset( $parsed_blocks[ $key ] ); } } return array_values( $parsed_blocks ); }