Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCEmailTemplateSelectiveApplier::replace_block_content_at_path
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_blocksoutput. - $source_block(array<string, mixed>) (required)
- The block whose content to copy in.
- $copy_attrs(true|false)
- Whether to take the source block's
attrsas well.
Default:false
WCEmailTemplateSelectiveApplier::replace_block_content_at_path() 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 );
}