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. Preserves the post block's attrs (no attribute-level apply in v1); copies the source block's innerHTML, innerContent, and innerBlocks over the target.

Метод класса: WCEmailTemplateSelectiveApplier{}

Хуков нет.

Возвращает

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

Использование

$result = WCEmailTemplateSelectiveApplier::replace_block_content_at_path( $blocks, $path, $source_block ): array;
$blocks(массив) (обязательный)
.
$path(array<int|string>) (обязательный)
Index path through parse_blocks output.
$source_block(array<string, mixed>) (обязательный)
The block whose content to copy in.

Код WCEmailTemplateSelectiveApplier::replace_block_content_at_path() WC 11.2.2

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