Automattic\WooCommerce\Blocks
BlockTypesController::register_block_categories
Register block categories
Used in combination with the block_categories_all to append WooCommerce Blocks related categories to the Gutenberg editor.
Method of the class: BlockTypesController{}
No Hooks.
Returns
null. Nothing (null).
Usage
$BlockTypesController = new BlockTypesController(); $BlockTypesController->register_block_categories( $categories );
- $categories(array) (required)
- The array of already registered categories.
BlockTypesController::register_block_categories() BlockTypesController::register block categories code WC 10.5.0
public function register_block_categories( $categories ) {
$woocommerce_block_categories = array(
array(
'slug' => 'woocommerce',
'title' => __( 'WooCommerce', 'woocommerce' ),
),
array(
'slug' => 'woocommerce-product-elements',
'title' => __( 'WooCommerce Product Elements', 'woocommerce' ),
),
);
return array_merge( $categories, $woocommerce_block_categories );
}