diff --git a/lib/client-assets.php b/lib/client-assets.php index 1488e8942abe55..2b1a04455c4b0b 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -203,10 +203,8 @@ function gutenberg_register_packages_scripts( $scripts ) { // Add dependencies that cannot be detected and generated by build tools. switch ( $handle ) { case 'wp-block-library': - $gutenberg_experiments = get_option( 'gutenberg-experiments' ); if ( - ! $gutenberg_experiments || - ! array_key_exists( 'gutenberg-no-tinymce', $gutenberg_experiments ) || + ! gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) || isset( $_COOKIE['requiresTinymce'] ) ) { array_push( $dependencies, 'editor' ); diff --git a/lib/experimental/disable-tinymce.php b/lib/experimental/disable-tinymce.php index f162dadcb52327..2095f230010fba 100644 --- a/lib/experimental/disable-tinymce.php +++ b/lib/experimental/disable-tinymce.php @@ -5,12 +5,6 @@ * @package gutenberg */ -// Power on/off button controlled by a Gutenberg experiment checkbox. -$gutenberg_experiments = get_option( 'gutenberg-experiments' ); -if ( ! $gutenberg_experiments || ! array_key_exists( 'gutenberg-no-tinymce', $gutenberg_experiments ) ) { - return; -} - // If user has already requested TinyMCE, we're ending the experiment. if ( isset( $_COOKIE['requiresTinymce'] ) ) { return; diff --git a/lib/experimental/editor-settings.php b/lib/experimental/editor-settings.php index 15df1a03373aaf..cf071ccfe592a3 100644 --- a/lib/experimental/editor-settings.php +++ b/lib/experimental/editor-settings.php @@ -97,7 +97,7 @@ function gutenberg_enable_experiments() { wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnablePatternEnhancements = true', 'before' ); } - if ( $gutenberg_experiments && array_key_exists( 'gutenberg-no-tinymce', $gutenberg_experiments ) ) { + if ( gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) ) { wp_add_inline_script( 'wp-block-library', 'window.__experimentalDisableTinymce = true', 'before' ); } } diff --git a/lib/load.php b/lib/load.php index a254b2b81a992c..d8056f483f4c60 100644 --- a/lib/load.php +++ b/lib/load.php @@ -104,7 +104,9 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/experimental/kses.php'; require __DIR__ . '/experimental/l10n.php'; require __DIR__ . '/experimental/navigation-fallback.php'; -require __DIR__ . '/experimental/disable-tinymce.php'; +if ( gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) ) { + require __DIR__ . '/experimental/disable-tinymce.php'; +} if ( gutenberg_is_experiment_enabled( 'gutenberg-interactivity-api-core-blocks' ) ) { require __DIR__ . '/experimental/interactivity-api/script-loader.php'; require __DIR__ . '/experimental/interactivity-api/blocks.php';