Automattic\WooCommerce\Admin\Features\ProductBlockEditor
BlockRegistry::register_block
Register a single block.
Method of the class: BlockRegistry{}
No Hooks.
Returns
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() BlockRegistry::register block code WC 10.8.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 );
}