MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors

Cleanup_Preprocessor::preprocess()publicWC 1.0

Method to preprocess the content before rendering

Method of the class: Cleanup_Preprocessor{}

No Hooks.

Return

Array.

Usage

$Cleanup_Preprocessor = new Cleanup_Preprocessor();
$Cleanup_Preprocessor->preprocess( $parsed_blocks, $layout, $styles ): array;
$parsed_blocks(array) (required)
Parsed blocks of the email.
$layout(array) (required)
-
$styles(array) (required)
-

Cleanup_Preprocessor::preprocess() code WC 9.8.1

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 );
}