Automattic\WooCommerce\Admin\Features\ProductBlockEditor

BlockRegistry::register_categories()publicWC 1.0

Register product related block categories.

Метод класса: BlockRegistry{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$BlockRegistry = new BlockRegistry();
$BlockRegistry->register_categories( $block_categories, $editor_context );
$block_categories(array[]) (обязательный)
Array of categories for block types.
$editor_context(WP_Block_Editor_Context) (обязательный)
The current block editor context.

Код BlockRegistry::register_categories() WC 8.7.0

public function register_categories( $block_categories, $editor_context ) {
	if ( INIT::EDITOR_CONTEXT_NAME === $editor_context->name ) {
		$block_categories[] = array(
			'slug'  => 'woocommerce',
			'title' => __( 'WooCommerce', 'woocommerce' ),
			'icon'  => null,
		);
	}

	return $block_categories;
}