Automattic\WooCommerce\Blocks

BlockTypesController::register_block_categories()publicWC 1.0

Register block categories

Used in combination with the block_categories_all to append WooCommerce Blocks related categories to the Gutenberg editor.

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

Хуков нет.

Возвращает

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

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

$BlockTypesController = new BlockTypesController();
$BlockTypesController->register_block_categories( $categories );
$categories(массив) (обязательный)
The array of already registered categories.

Код BlockTypesController::register_block_categories() WC 9.3.3

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 );
}