From 0cba369606d901f3f93749591d7388b266bb2b50 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Mon, 26 Sep 2022 11:58:19 +1000 Subject: [PATCH] Fix spacing property generation in flow layout type. --- lib/block-supports/layout.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index eaca6d4c70cc8c..060aa079018109 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -47,6 +47,13 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support $gap_value = isset( $gap_value['top'] ) ? $gap_value['top'] : null; } if ( null !== $gap_value && ! $should_skip_gap_serialization ) { + // Get spacing CSS variable from preset value if provided. + if ( is_string( $gap_value ) && str_contains( $gap_value, 'var:preset|spacing|' ) ) { + $index_to_splice = strrpos( $gap_value, '|' ) + 1; + $slug = _wp_to_kebab_case( substr( $gap_value, $index_to_splice ) ); + $gap_value = "var(--wp--preset--spacing--$slug)"; + } + array_push( $layout_styles, array(