Changeset 59359
- Timestamp:
- 11/06/2024 12:42:12 AM (4 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r59335 r59359 758 758 759 759 $this->theme_json = WP_Theme_JSON_Schema::migrate( $theme_json, $origin ); 760 $valid_block_names = array_keys( static::get_blocks_metadata() ); 760 $blocks_metadata = static::get_blocks_metadata(); 761 $valid_block_names = array_keys( $blocks_metadata ); 761 762 $valid_element_names = array_keys( static::ELEMENTS ); 762 $valid_variations = static::get_valid_block_style_variations( );763 $valid_variations = static::get_valid_block_style_variations( $blocks_metadata ); 763 764 $this->theme_json = static::unwrap_shared_block_style_variations( $this->theme_json, $valid_variations ); 764 765 $this->theme_json = static::sanitize( $this->theme_json, $valid_block_names, $valid_element_names, $valid_variations ); … … 3483 3484 $theme_json = WP_Theme_JSON_Schema::migrate( $theme_json, $origin ); 3484 3485 3485 $valid_block_names = array_keys( static::get_blocks_metadata() ); 3486 $blocks_metadata = static::get_blocks_metadata(); 3487 $valid_block_names = array_keys( $blocks_metadata ); 3486 3488 $valid_element_names = array_keys( static::ELEMENTS ); 3487 $valid_variations = static::get_valid_block_style_variations( );3489 $valid_variations = static::get_valid_block_style_variations( $blocks_metadata ); 3488 3490 3489 3491 $theme_json = static::sanitize( $theme_json, $valid_block_names, $valid_element_names, $valid_variations ); … … 4532 4534 * 4533 4535 * @since 6.6.0 4534 * 4536 * @since 6.8.0 Added the `$blocks_metadata` parameter. 4537 * 4538 * @param array $blocks_metadata Optional. List of metadata per block. Default is the metadata for all blocks. 4535 4539 * @return array Valid block style variations by block type. 4536 4540 */ 4537 protected static function get_valid_block_style_variations( ) {4541 protected static function get_valid_block_style_variations( $blocks_metadata = array() ) { 4538 4542 $valid_variations = array(); 4539 foreach ( self::get_blocks_metadata() as $block_name => $block_meta ) { 4543 $blocks_metadata = empty( $blocks_metadata ) ? static::get_blocks_metadata() : $blocks_metadata; 4544 foreach ( $blocks_metadata as $block_name => $block_meta ) { 4540 4545 if ( ! isset( $block_meta['styleVariations'] ) ) { 4541 4546 continue;
Note: See TracChangeset
for help on using the changeset viewer.