From 470a800116db3f79ab1e27fd670558957e4d317f Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 28 Oct 2020 11:28:11 +0100 Subject: [PATCH] Enable FSE blocks in FSE themes --- lib/experiments-page.php | 4 +++- packages/block-library/src/index.js | 6 +++--- packages/edit-post/src/index.js | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/experiments-page.php b/lib/experiments-page.php index df9e34e461115..208063729a7e1 100644 --- a/lib/experiments-page.php +++ b/lib/experiments-page.php @@ -97,7 +97,9 @@ function gutenberg_display_experiment_section() { * @return array Filtered editor settings. */ function gutenberg_experiments_editor_settings( $settings ) { - $experiments_settings = array(); + $experiments_settings = array( + '__unstableEnableFullSiteEditingBlocks' => gutenberg_is_fse_theme(), + ); $gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) ); if ( false !== $gradient_presets ) { $experiments_settings['gradients'] = $gradient_presets; diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index 3b307c574dfb4..b5b7493bef6f6 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -192,7 +192,7 @@ export const registerCoreBlocks = ( /** * Function to register experimental core blocks depending on editor settings. * - * @param {boolean} isSiteEditor Whether to enable site editor blocks. + * @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks. * @example * ```js * import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library'; @@ -202,13 +202,13 @@ export const registerCoreBlocks = ( */ export const __experimentalRegisterExperimentalCoreBlocks = process.env.GUTENBERG_PHASE === 2 - ? ( isSiteEditor ) => { + ? ( enableFSEBlocks ) => { [ navigation, navigationLink, // Register Full Site Editing Blocks. - ...( isSiteEditor + ...( enableFSEBlocks ? [ siteLogo, siteTagline, diff --git a/packages/edit-post/src/index.js b/packages/edit-post/src/index.js index 4a6f30517f7b1..a83aeb241d4b4 100644 --- a/packages/edit-post/src/index.js +++ b/packages/edit-post/src/index.js @@ -97,7 +97,9 @@ export function initializeEditor( ); registerCoreBlocks(); if ( process.env.GUTENBERG_PHASE === 2 ) { - __experimentalRegisterExperimentalCoreBlocks(); + __experimentalRegisterExperimentalCoreBlocks( + settings.__unstableEnableFullSiteEditingBlocks + ); } // Show a console log warning if the browser is not in Standards rendering mode.