Automattic\WooCommerce\Blocks\BlockTypes

MiniCart::get_inner_blocks_translations()protectedWC 1.0

Prepare translations for inner blocks and dependencies.

Method of the class: MiniCart{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->get_inner_blocks_translations();

MiniCart::get_inner_blocks_translations() code WC 9.4.2

protected function get_inner_blocks_translations() {
	$wp_scripts   = wp_scripts();
	$translations = array();

	$chunks        = $this->get_chunks_paths( $this->chunks_folder );
	$vendor_chunks = $this->get_chunks_paths( 'vendors--mini-cart-contents-block' );
	$shared_chunks = [ 'cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend' ];

	foreach ( array_merge( $chunks, $vendor_chunks, $shared_chunks ) as $chunk ) {
		$handle = 'wc-blocks-' . $chunk . '-chunk';
		$this->asset_api->register_script( $handle, $this->asset_api->get_block_asset_build_path( $chunk ), [], true );
		$translations[] = $wp_scripts->print_translations( $handle, false );
		wp_deregister_script( $handle );
	}

	$translations = array_filter( $translations );

	return implode( '', $translations );
}