BlockRegistry
in package
Removed product block editor block registry.
Tags
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
DEPRECATED_SINCE
Version that product editor APIs were deprecated in.
public
mixed
DEPRECATED_SINCE
= '10.9.0'
GENERIC_BLOCKS
Array of all available generic blocks.
public
mixed
GENERIC_BLOCKS
= array()
GENERIC_BLOCKS_DIR
Generic blocks directory.
public
mixed
GENERIC_BLOCKS_DIR
= ''
PRODUCT_FIELDS_BLOCKS
Array of all available product fields blocks.
public
mixed
PRODUCT_FIELDS_BLOCKS
= array()
PRODUCT_FIELDS_BLOCKS_DIR
Product fields blocks directory.
public
mixed
PRODUCT_FIELDS_BLOCKS_DIR
= ''
Properties
$instance
Singleton instance.
private
static BlockRegistry|null
$instance
= null
$removal_warning_logged
Whether the removal warning has already been logged for the current request.
private
static bool
$removal_warning_logged
= false
Methods
get_instance()
Get the singleton instance.
public
static get_instance() : BlockRegistry
Return values
BlockRegistry —is_registered()
Check if a block is registered.
public
is_registered(string $block_name) : bool
Parameters
- $block_name : string
-
Block name.
Return values
bool —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.jsonfile 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>> —unregister()
Unregister a block.
public
unregister(string $block_name) : void
Parameters
- $block_name : string
-
Block name.
Return values
void —__construct()
Constructor.
protected
__construct() : mixed
Return values
mixed —maybe_log_removal_warning()
Log a warning about the removed compatibility class.
private
static maybe_log_removal_warning() : void
