API / Minn\Theme / PageRenderer

PageRenderer final readonly class

Minn\Theme\PageRenderer · public/minn/src/Minn/Theme/PageRenderer.php · 185 lines

A whole page from the active block theme: the template the resolution maps to, rendered against the main query, inside the document shell the reference emits (skip link, wp-site-blocks, the skip-link target on the first main element).

Constants and properties

privatereadonly Minn\Content\Site $site

Promoted from the constructor.

privatereadonly Minn\Theme\Theme $theme

Promoted from the constructor.

privatereadonly Minn\Theme\Templates $templates

Promoted from the constructor.

privatereadonly Minn\Blocks\Renderer $renderer

Promoted from the constructor.

privatereadonly Minn\Theme\MainQueryBridge $bridge

Promoted from the constructor.

privatereadonly Minn\Theme\HeadLinks $headLinks

Promoted from the constructor.

privatereadonly ?Minn\Front\AdminBar $bar

Promoted from the constructor.

Public

new__construct(Minn\Content\Site $site, Minn\Theme\Theme $theme, Minn\Theme\Templates $templates, Minn\Blocks\Renderer $renderer, Minn\Theme\MainQueryBridge $bridge, Minn\Theme\HeadLinks $headLinks, ?Minn\Front\AdminBar $bar = NULL)#
staticcreate(Minn\Db $db, Minn\Theme\Theme $theme, Minn\Front\Permalinks $permalinks, int $perPage, ?Minn\Front\AdminBar $bar = NULL): self#

A page renderer over the database door.

methodbodyClasses(Minn\Front\Resolution $resolution, array $coreClasses): array#

The reference's body-class tokens: the singular and template tokens sit in front of the type token ("page", "single"), the custom-logo and embed tokens follow the core set, the paging tokens come after those, and the theme (and child theme) tokens close the list; then the body_class filter.

@return list<string>
methodthemeClasses(Minn\Front\Resolution $resolution, array $coreClasses): array#

The body-class tokens before plugins filter them (bodyClasses()). @return list<string>

@return list<string>
methodrender(Minn\Front\Resolution $resolution, array $coreClasses): ?string#

The page for a resolution, or null when the theme has no template for it.

Internals 3

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

privatedocument(Minn\Front\Resolution $resolution, array $coreClasses, array $template, Minn\Content\Page $query): string#

The block template's document: the blocks rendered, the head, the body classes, the footer.

$templatearray<string, mixed>
privateskipLinkTarget(string $body): array#

The skip link points at the first <main>: at its own id when the template gave it one, otherwise at the id the reference injects.

@return array{string, string} the body, the target id
privatehead(Minn\Front\Resolution $resolution, Minn\Theme\GlobalStyles $styles, ?Minn\Front\AdminBar $bar): string#

The head: the charset, then wp_head (the viewport, robots, title and discovery links from the reference's defaults, which a plugin may remove; the engine's stylesheets inside it, where the reference prints a theme's, after plugin styles), then the extension head (after the stylesheets, as the seam contract says), the bar's own.