Function that migrates a given theme.json structure to the last version.
Parameters
$theme_jsonarrayrequired- The structure to migrate.
$originstringoptional- What source of data this object represents.
One of'blocks','default','theme', or'custom'. Default'theme'.
Source
public static function migrate( $theme_json, $origin = 'theme' ) {
if ( ! isset( $theme_json['version'] ) ) {
$theme_json = array(
'version' => WP_Theme_JSON::LATEST_SCHEMA,
);
}
// Migrate each version in order starting with the current version.
switch ( $theme_json['version'] ) {
case 1:
$theme_json = self::migrate_v1_to_v2( $theme_json );
// Deliberate fall through. Once migrated to v2, also migrate to v3.
case 2:
$theme_json = self::migrate_v2_to_v3( $theme_json, $origin );
}
return $theme_json;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.