diff --git a/extensions/shared/block-category.js b/extensions/shared/block-category.js index 571ac1127c29f..1903d04b91bc6 100644 --- a/extensions/shared/block-category.js +++ b/extensions/shared/block-category.js @@ -1,19 +1,27 @@ /** * External dependencies */ -import { getCategories, setCategories } from '@wordpress/blocks'; +import { getCategories, setCategories, registerBlockCollection } from '@wordpress/blocks'; /** * Internal dependencies */ import JetpackLogo from '../shared/jetpack-logo'; -setCategories( [ - ...getCategories().filter( ( { slug } ) => slug !== 'jetpack' ), - // Add a Jetpack block category - { - slug: 'jetpack', +if ( typeof registerBlockCollection === 'function' ) { + registerBlockCollection( 'jetpack', { title: 'Jetpack', icon: , - }, -] ); + } ); +} else { + // This can be removed once G 7.3 is shipped in the Core version that is JP's minimum. + setCategories( [ + ...getCategories().filter( ( { slug } ) => slug !== 'jetpack' ), + // Add a Jetpack block category + { + slug: 'jetpack', + title: 'Jetpack', + icon: , + }, + ] ); +}