Skip to content

Commit

Permalink
Cover WordPress 6.0 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Apr 13, 2022
1 parent 5b9d6ca commit dc138d9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/compat/wordpress-6.0/block-editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ function gutenberg_get_block_editor_settings( $settings ) {
global $wp_version;
$is_wp_5_8 = version_compare( $wp_version, '5.8', '>=' ) && version_compare( $wp_version, '5.9', '<' );
$is_wp_5_9 = version_compare( $wp_version, '5.9', '>=' ) && version_compare( $wp_version, '6.0', '<' );
$is_wp_6_0 = version_compare( $wp_version, '6.0', '>=' );

// Make sure the styles array exists.
// In some contexts, like the navigation editor, it doesn't.
Expand All @@ -82,8 +83,9 @@ function gutenberg_get_block_editor_settings( $settings ) {
$styles_without_existing_global_styles = array();
foreach ( $settings['styles'] as $style ) {
if (
( $is_wp_5_8 && ! gutenberg_is_global_styles_in_5_8( $style ) ) ||
( $is_wp_5_9 && ! gutenberg_is_global_styles_in_5_9( $style ) )
( $is_wp_5_8 && ! gutenberg_is_global_styles_in_5_8( $style ) ) || // Can be removed when plugin minimum version is 5.9.
( $is_wp_5_9 && ! gutenberg_is_global_styles_in_5_9( $style ) ) || // Can be removed when plugin minimum version is 6.0.
( $is_wp_6_0 && ( ! isset( $style['isGlobalStyles'] ) || ! $style['isGlobalStyles'] ) )
) {
$styles_without_existing_global_styles[] = $style;
}
Expand Down

0 comments on commit dc138d9

Please sign in to comment.