From 66570b5682c970a99007e36653b1be1408ad7fff Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Thu, 16 Nov 2023 17:03:05 +1100 Subject: [PATCH 1/2] Layout: Fix issue where layout classnames were sometimes injected for blocks without layout support --- lib/block-supports/layout.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index 80be02db68360..c948c14b8851f 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -617,6 +617,10 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { $processor->add_class( $class_name ); } return $processor->get_updated_html(); + } elseif ( ! $block_supports_layout ) { + // Ensure that layout classnames are not injected if the block does not + // support layout, and no child layout styles were generated. + return $block_content; } $global_settings = gutenberg_get_global_settings(); From 3fdd63efab6eee5f871a451db6c90c14c0f6ec50 Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Thu, 16 Nov 2023 17:12:51 +1100 Subject: [PATCH 2/2] Simplify comment --- lib/block-supports/layout.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index c948c14b8851f..0a060b4602018 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -618,8 +618,7 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { } return $processor->get_updated_html(); } elseif ( ! $block_supports_layout ) { - // Ensure that layout classnames are not injected if the block does not - // support layout, and no child layout styles were generated. + // Ensure layout classnames are not injected if there is no layout support. return $block_content; }