Make WordPress Core

Changeset 54253


Ignore:
Timestamp:
09/20/2022 01:47:55 PM (2 years ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r54183 r54253  
    335335     *              and `typography`.
    336336     * @since 6.1.0 Added new side properties for `border`,
     337     *              added new property `shadow`,
    337338     *              updated `blockGap` to be allowed at any level.
    338339     * @var array
     
    357358            'duotone' => null,
    358359        ),
     360        'shadow'     => null,
    359361        'spacing'    => array(
    360362            'margin'   => null,
     
    585587        $styles_non_top_level = static::VALID_STYLES;
    586588        foreach ( array_keys( $styles_non_top_level ) as $section ) {
    587             foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) {
    588                 if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) {
    589                     unset( $styles_non_top_level[ $section ][ $prop ] );
     589            if ( array_key_exists( $section, $styles_non_top_level ) && is_array( $styles_non_top_level[ $section ] ) ) {
     590                foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) {
     591                    if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) {
     592                        unset( $styles_non_top_level[ $section ][ $prop ] );
     593                    }
    590594                }
    591595            }
Note: See TracChangeset for help on using the changeset viewer.