diff --git a/lib/customizer.php b/lib/customizer.php index cb221987ae97c4..154b08c5429893 100644 --- a/lib/customizer.php +++ b/lib/customizer.php @@ -55,10 +55,12 @@ function gutenberg_customize_register( $wp_customize ) { 'sanitize_callback' => 'gutenberg_customize_sanitize', ) ); - $wp_customize->add_section( - 'gutenberg_widget_blocks', - array( 'title' => __( 'Widget Blocks (Experimental)', 'gutenberg' ) ) - ); + if ( get_option( 'gutenberg-experiments' ) && array_key_exists( 'gutenberg-widget-experiments', get_option( 'gutenberg-experiments' ) ) ) { + $wp_customize->add_section( + 'gutenberg_widget_blocks', + array( 'title' => __( 'Widget Blocks (Experimental)', 'gutenberg' ) ) + ); + } $wp_customize->add_control( new WP_Customize_Widget_Blocks_Control( $wp_customize, diff --git a/lib/widgets-page.php b/lib/widgets-page.php index 6e5263f267522c..eb637d4ba01b2e 100644 --- a/lib/widgets-page.php +++ b/lib/widgets-page.php @@ -69,12 +69,16 @@ function gutenberg_widgets_init( $hook ) { ); } + $experiments_exist = get_option( 'gutenberg-experiments' ); + $legacy_widget_experiment = $experiments_exist ? array_key_exists( 'gutenberg-widget-experiments', get_option( 'gutenberg-experiments' ) ) : false; + $settings = array_merge( array( - 'disableCustomColors' => get_theme_support( 'disable-custom-colors' ), - 'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ), - 'imageSizes' => $available_image_sizes, - 'maxUploadFileSize' => $max_upload_size, + 'disableCustomColors' => get_theme_support( 'disable-custom-colors' ), + 'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ), + 'imageSizes' => $available_image_sizes, + 'maxUploadFileSize' => $max_upload_size, + '__experimentalEnableLegacyWidgetBlock' => $legacy_widget_experiment, ), gutenberg_get_legacy_widget_settings() ); diff --git a/packages/edit-widgets/src/index.js b/packages/edit-widgets/src/index.js index 7efa0d6c5a4dd2..1a7a610fc55ea2 100644 --- a/packages/edit-widgets/src/index.js +++ b/packages/edit-widgets/src/index.js @@ -40,6 +40,9 @@ export function initialize( id, settings ) { */ export function customizerInitialize( id, settings ) { registerCoreBlocks(); + if ( process.env.GUTENBERG_PHASE === 2 ) { + __experimentalRegisterExperimentalCoreBlocks( settings ); + } render(