API / Minn\Theme / ThemeJsonData

ThemeJsonData final class

Minn\Theme\ThemeJsonData · public/minn/src/Minn/Theme/ThemeJsonData.php · 82 lines

The theme's theme.json as plugins and the theme's own functions may change it (wp_theme_json_data_theme, a WP_Theme_JSON_Data they update with presets and settings of their own), as the reference's resolver hands it to them, and the core and site editor layers likewise (wp_theme_json_data_default, wp_theme_json_data_user). Worked out once a request for each set of callbacks, so a filter added late still counts.

Public

statictheme(array $json, string $dir): array#

The theme layer through wp_theme_json_data_theme; as written when nothing filters it. @param array<string, mixed> $json

$jsonarray<string, mixed>
staticlayer(string $origin, array $json): array#

The core layer (wp_theme_json_data_default, origin default) or the site editor's (wp_theme_json_data_user, origin custom) as plugins leave it, each a WP_Theme_JSON_Data they update; as given when nothing filters it. Worked out once a request for each set of callbacks and layer.

$jsonarray<string, mixed>
@return array<string, mixed>

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateasWritten(array $raw): array#

The filtered layer back in theme.json's own shape: each preset (and the spacing scale) the theme's list again, everything else in the order it came, as the reference's resolver keeps the layer's object.

$rawarray<string, mixed>
@return array<string, mixed>