From 9958965c6f2fa8c9e31b7c21f8f6c1ed0490a26b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 20 Sep 2022 13:47:55 +0000 Subject: [PATCH] Editor: Add `box-shadow` support for blocks through `theme.json` files. This makes it possible to add `box-shadow` to specific blocks (such as buttons or groups), allowing this to be configured in block themes without custom CSS. Props andrewserong, cbravobernal, madhudollu, scruffian, onemaggie. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54253 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 bfb659d2ed..e4c21f8e79 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 @@ class WP_Theme_JSON { */ $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 ] ); + } } } }