WooCommerce Code Reference

BlockRegistry
in package

Removed product block editor block registry.

Tags
deprecated
10.9.0

Product editor extension APIs were deprecated. The product block editor was removed in 11.0.0 with no replacement.

Table of Contents

DEPRECATED_SINCE  = '10.9.0'
Version that product editor APIs were deprecated in.
GENERIC_BLOCKS  = array()
Array of all available generic blocks.
GENERIC_BLOCKS_DIR  = ''
Generic blocks directory.
PRODUCT_FIELDS_BLOCKS  = array()
Array of all available product fields blocks.
PRODUCT_FIELDS_BLOCKS_DIR  = ''
Product fields blocks directory.
$instance  : BlockRegistry|null
Singleton instance.
$removal_warning_logged  : bool
Whether the removal warning has already been logged for the current request.
get_instance()  : BlockRegistry
Get the singleton instance.
is_registered()  : bool
Check if a block is registered.
register_block_type_from_metadata()  : false
Register a block type from metadata stored in the block.json file.
register_categories()  : array<string|int, array<string|int, mixed>>
Register product related block categories.
unregister()  : void
Unregister a block.
__construct()  : mixed
Constructor.
maybe_log_removal_warning()  : void
Log a warning about the removed compatibility class.

Constants

Properties

Methods

register_block_type_from_metadata()

Register a block type from metadata stored in the block.json file.

public register_block_type_from_metadata(string $file_or_folder) : false
Parameters
$file_or_folder : string

Path to the JSON file with metadata definition for the block or path to the folder where the block.json file is located.

Return values
false

register_categories()

Register product related block categories.

public register_categories(array<string|int, mixed> $block_categories, mixed $editor_context) : array<string|int, array<string|int, mixed>>
Parameters
$block_categories : array<string|int, mixed>

Array of categories for block types.

$editor_context : mixed

The current block editor context.

Return values
array<string|int, array<string|int, mixed>>