From baf835bacf712cf886d9ee1374d5e80f1c0b0fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Wed, 5 Feb 2020 18:33:25 +0100 Subject: [PATCH] Add Global Styles setting to experiments page --- lib/experiments-page.php | 12 ++++++++++++ lib/global-styles.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/experiments-page.php b/lib/experiments-page.php index 85d8944bddea1a..c5b0db8942f908 100644 --- a/lib/experiments-page.php +++ b/lib/experiments-page.php @@ -95,6 +95,17 @@ function gutenberg_initialize_experiments_settings() { 'id' => 'gutenberg-page-templates', ) ); + add_settings_field( + 'gutenberg-global-styles', + __( 'Global Styles', 'gutenberg' ), + 'gutenberg_display_experiment_field', + 'gutenberg-experiments', + 'gutenberg_experiments_section', + array( + 'label' => __( 'Enable Global Styles', 'gutenberg' ), + 'id' => 'gutenberg-global-styles', + ) + ); register_setting( 'gutenberg-experiments', 'gutenberg-experiments' @@ -147,6 +158,7 @@ function gutenberg_experiments_editor_settings( $settings ) { '__experimentalEnableFullSiteEditing' => gutenberg_is_experiment_enabled( 'gutenberg-full-site-editing' ), '__experimentalEnableFullSiteEditingDemo' => gutenberg_is_experiment_enabled( 'gutenberg-full-site-editing-demo' ), '__experimentalEnablePageTemplates' => gutenberg_is_experiment_enabled( 'gutenberg-page-templates' ), + '__experimentalEnableGlobalStyles' => gutenberg_is_experiment_enabled( 'gutenberg-global-styles' ), ); $gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) ); diff --git a/lib/global-styles.php b/lib/global-styles.php index 3c7b53522b663b..d7fb0afea693ed 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -299,7 +299,7 @@ function gutenberg_experimental_global_styles_register_cpt() { register_post_type( 'wp_global_styles', $args ); } -if ( gutenberg_is_experiment_enabled( 'global-styles' ) ) { +if ( gutenberg_is_experiment_enabled( 'gutenberg-global-styles' ) ) { add_action( 'init', 'gutenberg_experimental_global_styles_register_cpt' ); add_filter( 'body_class', 'gutenberg_experimental_global_styles_wp_gs_class_front_end' ); add_filter( 'admin_body_class', 'gutenberg_experimental_global_styles_wp_gs_class_editor' );