Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails

WCEmailTemplateSelectiveApplier::replace_block_content_at_path │ private static │ WC 1.0

Replace the block at the given path with another block's content: the source block's innerHTML, innerContent and innerBlocks, plus its attrs when $copy_attrs is set.

Method of the class: WCEmailTemplateSelectiveApplier{}

No Hooks.

Returns

array<int|string,. array<string, mixed>>

Usage

$result = WCEmailTemplateSelectiveApplier::replace_block_content_at_path( $blocks, $path, $source_block, $copy_attrs ): array;
$blocks(array) (required)
.
$path(array<int|string>) (required)
Index path through parse_blocks output.
$source_block(array<string, mixed>) (required)
The block whose content to copy in.
$copy_attrs(true|false)
Whether to take the source block's attrs as well.
Default: false

WCEmailTemplateSelectiveApplier::replace_block_content_at_path() code WC 11.3.0

private static function replace_block_content_at_path( array $blocks, array $path, array $source_block, bool $copy_attrs = false ): array {
	if ( empty( $path ) ) {
		return $blocks;
	}
	return self::replace_recursive( $blocks, array_values( $path ), 0, $source_block, $copy_attrs );
}