Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails

WCEmailTemplateSelectiveApplier::insert_block_at_pathprivate staticWC 1.0

Insert a block at the equivalent position in the merged tree using core's path as a guide. Best-effort: if a parent in the path doesn't exist in the post tree, append at the closest level.

Method of the class: WCEmailTemplateSelectiveApplier{}

No Hooks.

Returns

Array. array<string, mixed>>

Usage

$result = WCEmailTemplateSelectiveApplier::insert_block_at_path( $blocks, $path, $new_block ): array;
$blocks(array) (required)
.
$path(array<int|string>) (required)
Core-side index path of the block to insert.
$new_block(array) (required)
.

WCEmailTemplateSelectiveApplier::insert_block_at_path() code WC 10.9.1

private static function insert_block_at_path( array $blocks, array $path, array $new_block ): array {
	if ( empty( $path ) ) {
		return $blocks;
	}
	return self::insert_recursive( $blocks, array_values( $path ), 0, $new_block );
}