API / Minn\Theme / ThemeStyles

ThemeStyles final readonly class

Minn\Theme\ThemeStyles · public/minn/src/Minn/Theme/ThemeStyles.php · 142 lines

The active theme's global styles as wp/v2/global-styles/themes/{stylesheet} reports them: the engine's defaults (captured from the reference under a theme with no theme.json) with the theme's own settings and styles over them, and the style variations the theme ships.

Constants and properties

privatereadonly ?Minn\Theme\Theme $theme

Promoted from the constructor.

propreadonly string $stylesheet

Promoted from the constructor.

privatereadonly ?array $core

Promoted from the constructor.

Public

new__construct(?Minn\Theme\Theme $theme, string $stylesheet, ?array $core = NULL)#
$themeTheme|nullnull under a theme without theme.json: the defaults alone
$corearray{settings?: array, styles?: array}|nullcore's layer when not the stored one (a plugin changed it)
methodwithFilteredCore(): self#

The same styling data over core's layer as wp_theme_json_data_default leaves it, for the places the reference reads core's layer through that filter (its resolver's core and merged data).

staticforSite(Minn\Content\Site $site, Minn\Front\Permalinks $permalinks, string $themesDir): self#

The site's active theme as styling data, whether or not it is a block theme.

methodsettings(): array#

Settings: presets by origin, appearanceTools expanded, the defaults underneath.

methodpatterns(): array#

The pattern directory slugs the theme.json lists (its patterns), as given; [] when it lists none. @return array<mixed>

@return array<mixed>
methodstyles(): array#

Styles: the theme's over the defaults, block style partials and section styles in, every var:preset token resolved.

methodvariations(): array#

The style variations under styles/: every JSON file there that names no blockTypes (those are block style partials), the parent theme's first, in path order, $schema dropped and the nodes normalized the way the theme's own are.

@return list<array>

Internals 4

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

privatewithSectionStyles(array $styles, array $partials): array#

A root styles.variations node names section styles by the slug of the block style partial that declares them; each lands under every block type that partial names, the blocks it has to add in name order, and the root node goes.

$partialsarray<string, list<string>>slug => block types
privatepartials(): array#

The block style partials under styles/: slug => the block types each names.

@return array<string, list<string>>
privatedefaults(): array#
@return array{settings?: array, styles?: array} core's layer: the one given, else the stored one
privatestoredCore(): array#
@return array{settings: array, styles: array} core's own layer as stored