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.
Метод класса: BlockTypesController{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$BlockTypesController = new BlockTypesController(); $BlockTypesController->register_block_categories( $categories );
- $categories(массив) (обязательный)
- The array of already registered categories.
Код BlockTypesController::register_block_categories() BlockTypesController::register block categories 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 );
}