Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCEmailTemplateSelectiveApplier::replace_block_content_at_path
Replace the block at the given path with another block's content. Preserves the post block's attrs (no attribute-level apply in v1); copies the source block's innerHTML, innerContent, and innerBlocks over the target.
Method of the class: WCEmailTemplateSelectiveApplier{}
No Hooks.
Returns
Array
Usage
$result = WCEmailTemplateSelectiveApplier::replace_block_content_at_path( $blocks, $path, $source_block ): array;
- $blocks(array) (required)
- .
- $path(array<int|string>) (required)
- Index path through
parse_blocksoutput. - $source_block(array) (required)
- .
WCEmailTemplateSelectiveApplier::replace_block_content_at_path() WCEmailTemplateSelectiveApplier::replace block content at path code WC 10.9.1
private static function replace_block_content_at_path( array $blocks, array $path, array $source_block ): array {
if ( empty( $path ) ) {
return $blocks;
}
return self::replace_recursive( $blocks, array_values( $path ), 0, $source_block );
}