From 5d19f85bd8d67dd8962caa5640b58b2f94c57ea9 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 8 Dec 2021 19:34:54 +0400 Subject: [PATCH 1/3] Fix theme requirement validation with WP 5.8 --- lib/full-site-editing/full-site-editing.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/full-site-editing/full-site-editing.php b/lib/full-site-editing/full-site-editing.php index 51b57dbad997e9..85ba2a5225a705 100644 --- a/lib/full-site-editing/full-site-editing.php +++ b/lib/full-site-editing/full-site-editing.php @@ -105,3 +105,13 @@ function gutenberg_site_editor_load_block_editor_scripts_and_styles( $is_block_e : $is_block_editor_screen; } add_filter( 'should_load_block_editor_scripts_and_styles', 'gutenberg_site_editor_load_block_editor_scripts_and_styles' ); + +/** + * Note: We have to maintain this function for backward compatibility with WP 5.8. + * Only remove once 5.9 is the minimum supported WordPress version for the Gutenberg plugin. + * + * @return boolean Whether the current theme is a block theme or not. + */ +function gutenberg_is_fse_theme() { + return wp_is_block_theme(); +} From 343c62fab1f3a619131361c2b6fd77070f4a4985 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 8 Dec 2021 20:37:46 +0400 Subject: [PATCH 2/3] Use compat file --- lib/compat/wordpress-5.9/theme.php | 10 ++++++++++ lib/full-site-editing/full-site-editing.php | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/compat/wordpress-5.9/theme.php b/lib/compat/wordpress-5.9/theme.php index 43862e6bf6117a..c1b5ab579ee7d1 100644 --- a/lib/compat/wordpress-5.9/theme.php +++ b/lib/compat/wordpress-5.9/theme.php @@ -16,3 +16,13 @@ function wp_is_block_theme() { is_readable( get_theme_file_path( '/templates/index.html' ) ); } } + +/** + * Note: We have to maintain this function for backward compatibility with WP 5.8. + * Only remove once 5.9 is the minimum supported WordPress version for the Gutenberg plugin. + * + * @return boolean Whether the current theme is a block theme or not. + */ +function gutenberg_is_fse_theme() { + return wp_is_block_theme(); +} diff --git a/lib/full-site-editing/full-site-editing.php b/lib/full-site-editing/full-site-editing.php index 85ba2a5225a705..51b57dbad997e9 100644 --- a/lib/full-site-editing/full-site-editing.php +++ b/lib/full-site-editing/full-site-editing.php @@ -105,13 +105,3 @@ function gutenberg_site_editor_load_block_editor_scripts_and_styles( $is_block_e : $is_block_editor_screen; } add_filter( 'should_load_block_editor_scripts_and_styles', 'gutenberg_site_editor_load_block_editor_scripts_and_styles' ); - -/** - * Note: We have to maintain this function for backward compatibility with WP 5.8. - * Only remove once 5.9 is the minimum supported WordPress version for the Gutenberg plugin. - * - * @return boolean Whether the current theme is a block theme or not. - */ -function gutenberg_is_fse_theme() { - return wp_is_block_theme(); -} From 498dd4e251147588f53a456c401186bbb64dad93 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 8 Dec 2021 21:25:23 +0400 Subject: [PATCH 3/3] Update comment --- lib/compat/wordpress-5.9/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-5.9/theme.php b/lib/compat/wordpress-5.9/theme.php index c1b5ab579ee7d1..7bfe11f604c5b6 100644 --- a/lib/compat/wordpress-5.9/theme.php +++ b/lib/compat/wordpress-5.9/theme.php @@ -19,7 +19,7 @@ function wp_is_block_theme() { /** * Note: We have to maintain this function for backward compatibility with WP 5.8. - * Only remove once 5.9 is the minimum supported WordPress version for the Gutenberg plugin. + * The `validate_theme_requirements` method is using `gutenberg_is_fse_theme` in older versions of WP. * * @return boolean Whether the current theme is a block theme or not. */