Changeset 58354 for trunk/src/wp-includes/class-wp-theme-json-schema.php
- Timestamp:
- 06/06/2024 08:00:08 AM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json-schema.php
r58339 r58354 36 36 * 37 37 * @since 5.9.0 38 * @since 6.6.0 Migrate up to v3 .38 * @since 6.6.0 Migrate up to v3 and add $origin parameter. 39 39 * 40 40 * @param array $theme_json The structure to migrate. 41 * 41 * @param string $origin Optional. What source of data this object represents. 42 * One of 'blocks', 'default', 'theme', or 'custom'. Default 'theme'. 42 43 * @return array The structure in the last version. 43 44 */ 44 public static function migrate( $theme_json ) {45 public static function migrate( $theme_json, $origin = 'theme' ) { 45 46 if ( ! isset( $theme_json['version'] ) ) { 46 47 $theme_json = array( … … 55 56 // Deliberate fall through. Once migrated to v2, also migrate to v3. 56 57 case 2: 57 $theme_json = self::migrate_v2_to_v3( $theme_json );58 $theme_json = self::migrate_v2_to_v3( $theme_json, $origin ); 58 59 } 59 60 … … 101 102 * @since 6.6.0 102 103 * 103 * @param array $old Data to migrate. 104 * 104 * @param array $old Data to migrate. 105 * @param string $origin What source of data this object represents. 106 * One of 'blocks', 'default', 'theme', or 'custom'. 105 107 * @return array Data with defaultFontSizes set to false. 106 108 */ 107 private static function migrate_v2_to_v3( $old ) {109 private static function migrate_v2_to_v3( $old, $origin ) { 108 110 // Copy everything. 109 111 $new = $old; … … 116 118 * as they should take on the value of the theme origin. 117 119 */ 118 if ( 119 isset( $new['isGlobalStylesUserThemeJSON'] ) && 120 true === $new['isGlobalStylesUserThemeJSON'] 121 ) { 120 if ( 'custom' === $origin ) { 122 121 return $new; 123 122 }
Note: See TracChangeset
for help on using the changeset viewer.