Skip to content

Commit

Permalink
Open up theme.json processing (#22520)
Browse files Browse the repository at this point in the history
* Do not require FSE experiment
* Remove the site editor check
  • Loading branch information
nosolosw authored May 21, 2020
1 parent e290640 commit e8b9de4
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions lib/global-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,31 +481,14 @@ function gutenberg_experimental_global_styles_enqueue_assets() {
wp_enqueue_style( 'global-styles' );
}

/**
* Whether the loaded page is the site editor.
*
* @return boolean Whether the loaded page is the site editor.
*/
function gutenberg_experimental_global_styles_is_site_editor() {
if ( ! function_exists( 'get_current_screen' ) ) {
return false;
}

$screen = get_current_screen();
return ! empty( $screen ) && gutenberg_is_edit_site_page( $screen->id );
}

/**
* Adds the necessary data for the Global Styles client UI to the block settings.
*
* @param array $settings Existing block editor settings.
* @return array New block editor settings
*/
function gutenberg_experimental_global_styles_settings( $settings ) {
if (
! gutenberg_experimental_global_styles_has_theme_json_support() ||
! gutenberg_experimental_global_styles_is_site_editor()
) {
if ( ! gutenberg_experimental_global_styles_has_theme_json_support() ) {
return $settings;
}

Expand Down Expand Up @@ -559,8 +542,6 @@ function gutenberg_experimental_global_styles_register_cpt() {
register_post_type( 'wp_global_styles', $args );
}

if ( gutenberg_is_experiment_enabled( 'gutenberg-full-site-editing' ) ) {
add_action( 'init', 'gutenberg_experimental_global_styles_register_cpt' );
add_filter( 'block_editor_settings', 'gutenberg_experimental_global_styles_settings' );
add_action( 'wp_enqueue_scripts', 'gutenberg_experimental_global_styles_enqueue_assets' );
}
add_action( 'init', 'gutenberg_experimental_global_styles_register_cpt' );
add_filter( 'block_editor_settings', 'gutenberg_experimental_global_styles_settings' );
add_action( 'wp_enqueue_scripts', 'gutenberg_experimental_global_styles_enqueue_assets' );

0 comments on commit e8b9de4

Please sign in to comment.