diff --git a/projects/plugins/jetpack/changelog/fix-dont-list-form-blocks-twice b/projects/plugins/jetpack/changelog/fix-dont-list-form-blocks-twice new file mode 100644 index 000000000000..e230146ce0b8 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-dont-list-form-blocks-twice @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Forms: Remove duplicate display of form blocks under the "Jetpack" block inserter section; form blocks now only appear under the "Forms" category. diff --git a/projects/plugins/jetpack/class.jetpack-gutenberg.php b/projects/plugins/jetpack/class.jetpack-gutenberg.php index 967179896cb6..7c75e2a3917a 100644 --- a/projects/plugins/jetpack/class.jetpack-gutenberg.php +++ b/projects/plugins/jetpack/class.jetpack-gutenberg.php @@ -781,10 +781,10 @@ public static function enqueue_block_editor_assets() { $jetpack_plan = Jetpack_Plan::get(); $initial_state = array( - 'available_blocks' => self::get_availability(), - 'blocks_variation' => $blocks_variation, - 'modules' => $modules, - 'jetpack' => array( + 'available_blocks' => self::get_availability(), + 'blocks_variation' => $blocks_variation, + 'modules' => $modules, + 'jetpack' => array( 'is_active' => Jetpack::is_connection_ready(), 'is_current_user_connected' => $is_current_user_connected, /** This filter is documented in class.jetpack-gutenberg.php */ @@ -811,22 +811,14 @@ public static function enqueue_block_editor_assets() { */ 'republicize_enabled' => apply_filters( 'jetpack_block_editor_republicize_feature', true ), ), - 'siteFragment' => $status->get_site_suffix(), - 'adminUrl' => esc_url( admin_url() ), - 'tracksUserData' => $user_data, - 'wpcomBlogId' => $blog_id, - 'allowedMimeTypes' => wp_get_mime_types(), - 'siteLocale' => str_replace( '_', '-', get_locale() ), - 'ai-assistant' => $ai_assistant_state, - 'screenBase' => $screen_base, - /** - * Should all blocks get registered the Jetpack block collection in addition to their own categories? - * - * @since 15.3 - * - * @param boolean true Enable Jetpack block collection in block categories. Defaults to true. - */ - 'registerBlockCollection' => apply_filters( 'jetpack_register_block_collection', true ), + 'siteFragment' => $status->get_site_suffix(), + 'adminUrl' => esc_url( admin_url() ), + 'tracksUserData' => $user_data, + 'wpcomBlogId' => $blog_id, + 'allowedMimeTypes' => wp_get_mime_types(), + 'siteLocale' => str_replace( '_', '-', get_locale() ), + 'ai-assistant' => $ai_assistant_state, + 'screenBase' => $screen_base, /** * Add your own feature flags to the block editor. * @@ -836,8 +828,8 @@ public static function enqueue_block_editor_assets() { * * @param array true Enable the RePublicize UI in the block editor context. Defaults to true. */ - 'feature_flags' => apply_filters( 'jetpack_block_editor_feature_flags', array() ), - 'pluginBasePath' => plugins_url( '', Constants::get_constant( 'JETPACK__PLUGIN_FILE' ) ), + 'feature_flags' => apply_filters( 'jetpack_block_editor_feature_flags', array() ), + 'pluginBasePath' => plugins_url( '', Constants::get_constant( 'JETPACK__PLUGIN_FILE' ) ), ); wp_localize_script( diff --git a/projects/plugins/jetpack/extensions/shared/block-category.js b/projects/plugins/jetpack/extensions/shared/block-category.js index 1b4af29495aa..1b3386d561a5 100644 --- a/projects/plugins/jetpack/extensions/shared/block-category.js +++ b/projects/plugins/jetpack/extensions/shared/block-category.js @@ -1,14 +1,7 @@ import { JetpackLogo } from '@automattic/jetpack-shared-extension-utils/icons'; -import { getCategories, setCategories, registerBlockCollection } from '@wordpress/blocks'; +import { getCategories, setCategories } from '@wordpress/blocks'; import { __ } from '@wordpress/i18n'; -if ( window?.Jetpack_Editor_Initial_State?.registerBlockCollection ) { - registerBlockCollection( 'jetpack', { - title: 'Jetpack', - icon: , - } ); -} - // We're moving Form specific blocks to a new 'Forms' category // that should appear before the 'monetize' and 'grow' categories setCategories( [