From cce29eb92f2793307cfc2ddc2b4ba537694240e7 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 31 May 2023 13:36:17 +0300 Subject: [PATCH] packages/style-engine/docs/using-the-style-engine-with-block-supports.md --- .../using-the-style-engine-with-block-supports.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/style-engine/docs/using-the-style-engine-with-block-supports.md b/packages/style-engine/docs/using-the-style-engine-with-block-supports.md index 3587a89388ed0..6a445c81bd842 100644 --- a/packages/style-engine/docs/using-the-style-engine-with-block-supports.md +++ b/packages/style-engine/docs/using-the-style-engine-with-block-supports.md @@ -133,8 +133,18 @@ function gutenberg_apply_colors_support( $block_type, $block_attributes ) { $color_block_styles = array(); // Set the color style values according to whether the block has support and does not skip serialization. - $spacing_block_styles['text'] = $has_text_support && ! $skips_serialization_of_color_text ? _wp_array_get( $block_color_styles, array( 'text' ), null ) : null; - $spacing_block_styles['background'] = $has_background_support && ! $skips_serialization_of_color_background ? _wp_array_get( $block_color_styles, array( 'background' ), null ) : null; + $spacing_block_styles['text'] = null; + if ( $has_text_support && ! $skips_serialization_of_color_text ) { + $spacing_block_styles['text'] = isset( $block_color_styles['text'] ) + ? _wp_array_get( $block_color_styles, array( 'text' ), null ) + : null; + } + $spacing_block_styles['background'] = null; + if ( $has_background_support && ! $skips_serialization_of_color_background ) { + $spacing_block_styles['background'] = isset( $block_color_styles['background'] ) + ? _wp_array_get( $block_color_styles, array( 'background' ), null ) + : null; + } // Pass the color styles, excluding those that have no support or skip serialization, to the Style Engine. $styles = wp_style_engine_get_styles( array( 'color' => $block_color_styles ) );