Changeset 52434 for trunk/src/wp-includes/class-wp-theme-json.php
- Timestamp:
- 01/04/2022 05:37:25 AM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-theme-json.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r52403 r52434 318 318 'margin' => null, 319 319 'padding' => null, 320 'blockGap' => null,320 'blockGap' => 'top', 321 321 ), 322 322 'typography' => array( … … 473 473 $output = array_intersect_key( $input, array_flip( self::VALID_TOP_LEVEL_KEYS ) ); 474 474 475 // Some styles are only meant to be available at the top-level (e.g.: blockGap), 476 // hence, the schema for blocks & elements should not have them. 477 $styles_non_top_level = self::VALID_STYLES; 478 foreach ( array_keys( $styles_non_top_level ) as $section ) { 479 foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) { 480 if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) { 481 unset( $styles_non_top_level[ $section ][ $prop ] ); 482 } 483 } 484 } 485 475 486 // Build the schema based on valid block & element names. 476 487 $schema = array(); 477 488 $schema_styles_elements = array(); 478 489 foreach ( $valid_element_names as $element ) { 479 $schema_styles_elements[ $element ] = self::VALID_STYLES;490 $schema_styles_elements[ $element ] = $styles_non_top_level; 480 491 } 481 492 $schema_styles_blocks = array(); … … 483 494 foreach ( $valid_block_names as $block ) { 484 495 $schema_settings_blocks[ $block ] = self::VALID_SETTINGS; 485 $schema_styles_blocks[ $block ] = self::VALID_STYLES;496 $schema_styles_blocks[ $block ] = $styles_non_top_level; 486 497 $schema_styles_blocks[ $block ]['elements'] = $schema_styles_elements; 487 498 }
Note: See TracChangeset
for help on using the changeset viewer.