diff --git a/lib/customizer.php b/lib/customizer.php index cb221987ae97c4..771ced523f5c98 100644 --- a/lib/customizer.php +++ b/lib/customizer.php @@ -55,20 +55,22 @@ function gutenberg_customize_register( $wp_customize ) { 'sanitize_callback' => 'gutenberg_customize_sanitize', ) ); - $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, + if ( get_option( 'gutenberg-experiments' ) && array_key_exists( 'gutenberg-widget-experiments', get_option( 'gutenberg-experiments' ) ) ) { + $wp_customize->add_section( 'gutenberg_widget_blocks', - array( - 'section' => 'gutenberg_widget_blocks', - 'settings' => 'gutenberg_widget_blocks', + array( 'title' => __( 'Widget Blocks (Experimental)', 'gutenberg' ) ) + ); + $wp_customize->add_control( + new WP_Customize_Widget_Blocks_Control( + $wp_customize, + 'gutenberg_widget_blocks', + array( + 'section' => 'gutenberg_widget_blocks', + 'settings' => 'gutenberg_widget_blocks', + ) ) - ) - ); + ); + } } add_action( 'customize_register', 'gutenberg_customize_register' ); diff --git a/lib/widgets-page.php b/lib/widgets-page.php index 6e5263f267522c..9ecb3b1139cefd 100644 --- a/lib/widgets-page.php +++ b/lib/widgets-page.php @@ -97,7 +97,7 @@ function gutenberg_widgets_init( $hook ) { wp.editWidgets.%s( "widgets-editor", %s ); } );', $initializer_name, - wp_json_encode( $settings ) + wp_json_encode( gutenberg_experiments_editor_settings( $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(