From 684ad603803b0a66ec29d3ae4d72b73052d444ca Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:48:18 +1000 Subject: [PATCH] Backport box-shadow support for blocks via theme.json --- src/wp-includes/class-wp-theme-json.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index bfb659d2ed583..e4c21f8e79946 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -334,6 +334,7 @@ class WP_Theme_JSON { * added new properties for `border`, `filter`, `spacing`, * and `typography`. * @since 6.1.0 Added new side properties for `border`, + * added new property `shadow`, * updated `blockGap` to be allowed at any level. * @var array */ @@ -356,6 +357,7 @@ class WP_Theme_JSON { 'filter' => array( 'duotone' => null, ), + 'shadow' => null, 'spacing' => array( 'margin' => null, 'padding' => null, @@ -584,9 +586,11 @@ protected static function sanitize( $input, $valid_block_names, $valid_element_n */ $styles_non_top_level = static::VALID_STYLES; foreach ( array_keys( $styles_non_top_level ) as $section ) { - foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) { - if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) { - unset( $styles_non_top_level[ $section ][ $prop ] ); + if ( array_key_exists( $section, $styles_non_top_level ) && is_array( $styles_non_top_level[ $section ] ) ) { + foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) { + if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) { + unset( $styles_non_top_level[ $section ][ $prop ] ); + } } } }