[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> class-wp-theme-json-schema.php (summary)

WP_Theme_JSON_Schema class

File Size: 229 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Theme_JSON_Schema:: (6 methods):
  migrate()
  migrate_v1_to_v2()
  migrate_v2_to_v3()
  rename_paths()
  rename_settings()
  unset_setting_by_path()


Class: WP_Theme_JSON_Schema  - X-Ref

Class that migrates a given theme.json structure to the latest schema.

This class is for internal core usage and is not supposed to be used by extenders (plugins and/or themes).
This is a low-level API that may need to do breaking changes. Please,
use get_global_settings, get_global_styles, and get_global_stylesheet instead.

migrate( $theme_json, $origin = 'theme' )   X-Ref
Function that migrates a given theme.json structure to the last version.

param: array $theme_json The structure to migrate.
param: string $origin    Optional. What source of data this object represents.
return: array The structure in the last version.

migrate_v1_to_v2( $old )   X-Ref
Removes the custom prefixes for a few properties
that were part of v1:

'border.customRadius'         => 'border.radius',
'spacing.customMargin'        => 'spacing.margin',
'spacing.customPadding'       => 'spacing.padding',
'typography.customLineHeight' => 'typography.lineHeight',

param: array $old Data to migrate.
return: array Data without the custom prefixes.

migrate_v2_to_v3( $old, $origin )   X-Ref
Migrates from v2 to v3.

- Sets settings.typography.defaultFontSizes to false if settings.typography.fontSizes are defined.
- Sets settings.spacing.defaultSpacingSizes to false if settings.spacing.spacingSizes are defined.
- Prevents settings.spacing.spacingSizes from merging with settings.spacing.spacingScale by
unsetting spacingScale when spacingSizes are defined.

param: array $old     Data to migrate.
param: string $origin What source of data this object represents.
return: array Data with defaultFontSizes set to false.

rename_paths( $settings, $paths_to_rename )   X-Ref
Processes the settings subtree.

param: array $settings        Array to process.
param: array $paths_to_rename Paths to rename.
return: array The settings in the new format.

rename_settings( &$settings, $paths_to_rename )   X-Ref
Processes a settings array, renaming or moving properties.

param: array $settings        Reference to settings either defaults or an individual block's.
param: array $paths_to_rename Paths to rename.

unset_setting_by_path( &$settings, $path )   X-Ref
Removes a property from within the provided settings by its path.

param: array $settings Reference to the current settings array.
param: array $path Path to the property to be removed.



Generated : Tue Dec 24 08:20:01 2024 Cross-referenced by PHPXref