Changeset 58228
- Timestamp:
- 05/29/2024 07:44:30 AM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r58226 r58228 732 732 $valid_block_names = array_keys( static::get_blocks_metadata() ); 733 733 $valid_element_names = array_keys( static::ELEMENTS ); 734 $valid_variations = array(); 735 foreach ( self::get_blocks_metadata() as $block_name => $block_meta ) { 736 if ( ! isset( $block_meta['styleVariations'] ) ) { 737 continue; 738 } 739 $valid_variations[ $block_name ] = array_keys( $block_meta['styleVariations'] ); 740 } 741 $theme_json = static::sanitize( $this->theme_json, $valid_block_names, $valid_element_names, $valid_variations ); 742 $this->theme_json = static::maybe_opt_in_into_settings( $theme_json ); 734 $valid_variations = static::get_valid_block_style_variations(); 735 $theme_json = static::sanitize( $this->theme_json, $valid_block_names, $valid_element_names, $valid_variations ); 736 $this->theme_json = static::maybe_opt_in_into_settings( $theme_json ); 743 737 744 738 // Internally, presets are keyed by origin. … … 3078 3072 $valid_block_names = array_keys( static::get_blocks_metadata() ); 3079 3073 $valid_element_names = array_keys( static::ELEMENTS ); 3080 $valid_variations = array(); 3081 foreach ( self::get_blocks_metadata() as $block_name => $block_meta ) { 3082 if ( ! isset( $block_meta['styleVariations'] ) ) { 3083 continue; 3084 } 3085 $valid_variations[ $block_name ] = array_keys( $block_meta['styleVariations'] ); 3086 } 3074 $valid_variations = static::get_valid_block_style_variations(); 3087 3075 3088 3076 $theme_json = static::sanitize( $theme_json, $valid_block_names, $valid_element_names, $valid_variations ); … … 4033 4021 return implode( ',', $result ); 4034 4022 } 4023 4024 /** 4025 * Collects valid block style variations keyed by block type. 4026 * 4027 * @since 6.6.0 4028 * 4029 * @return array Valid block style variations by block type. 4030 */ 4031 protected static function get_valid_block_style_variations() { 4032 $valid_variations = array(); 4033 foreach ( self::get_blocks_metadata() as $block_name => $block_meta ) { 4034 if ( ! isset( $block_meta['styleVariations'] ) ) { 4035 continue; 4036 } 4037 $valid_variations[ $block_name ] = array_keys( $block_meta['styleVariations'] ); 4038 } 4039 4040 return $valid_variations; 4041 } 4035 4042 }
Note: See TracChangeset
for help on using the changeset viewer.