Automattic\WooCommerce\Admin\Features\ProductBlockEditor

BlockRegistry::register_block()privateWC 1.0

Register a single block.

Method of the class: BlockRegistry{}

No Hooks.

Return

WP_Block_Type|false. The registered block type on success, or false on failure.

Usage

// private - for code of main (parent) class only
$result = $this->register_block( $block_name, $block_dir );
$block_name(string) (required)
Block name.
$block_dir(string) (required)
Block directory.

BlockRegistry::register_block() code WC 9.0.1

private function register_block( $block_name, $block_dir ) {
	$block_name      = $this->remove_block_prefix( $block_name );
	$block_json_file = $this->get_file_path( $block_name . '/block.json', $block_dir );

	return $this->register_block_type_from_metadata( $block_json_file );
}