Automattic\WooCommerce\Blocks\Assets

Api::generate_block_metadata_path │ public │ WC 11.3.0

Generate the path to a block's metadata.

Method of the class: Api{}

No Hooks.

Returns

string.

Usage

$Api = new Api();
$Api->generate_block_metadata_path( $block_name, $path );
$block_name(string) (required)
The block to get metadata for.
$path(string)
The path to the metadata file inside the 'assets/client/blocks' folder.
Default: ''

Changelog

Since 11.3.0 Introduced.

Api::generate_block_metadata_path() code WC 11.3.0

public function generate_block_metadata_path( $block_name, $path = '' ) {
	return $this->package->get_path( 'assets/client/blocks/' . $path . $block_name . '/block.json' );
}