final class PageRenderer implements PageOutputInterface (View source)

Renders the shared page chrome (header, footer, Twig globals) around controller-rendered templates.

The permission, server-info and debug-query lookups arrive as closures so they stay deferred until a template actually needs them, and so this class never triggers authentication or database work on construction.

Constants

private MIN_SESSION_KEY_LENGTH

Shorter than the 46 characters the installer writes, so a generated key never trips the warning.

Methods

__construct(AppManager $app, ConfigurationInterface $config, CsrfTokenService $csrfTokenService, UserContextService $userContextService, ModuleRegistry $moduleRegistry, bool $isApiBackend, Closure $hasPermission, Closure $getPdnsServerInfo, Closure $getDebugQueries, bool $wideLayout, SessionInterface $session, Closure|null $pendingChangeRequestCount = null)

No description

void
renderPage(string $template, array $params, array $requestData, string $pageTitle, array|null $systemMessages, array|null $scriptMessages)

A full page: the chrome, then $template rendered with $params.

void
renderChrome(array $requestData, string $pageTitle, array|null $systemMessages)

The chrome alone, which is how an error page shows its system messages.

void
renderHeader(array $requestData, string $pageTitle, array|null $systemMessages = null, array|null $scriptMessages = null)

Renders the header of the page.

void
renderFooter()

Renders the footer of the page.

array
languageVars()

Language selector variables for the current request, built once and shared by the header dropdown, the page body (login form's hidden userlang field), and any later render call in the same request.

array
getLanguageSelectorVars(string $activeLocale)

Build the login-page language selector variables: the active locale, the dropdown options, and a visibility flag. Shared by the header dropdown and the login form's hidden userlang field so the chosen language survives form submission.

string
resolveActiveLocale()

Returns the locale the translator was built with, so rendered strings and the page's lang metadata always agree.

Details

__construct(AppManager $app, ConfigurationInterface $config, CsrfTokenService $csrfTokenService, UserContextService $userContextService, ModuleRegistry $moduleRegistry, bool $isApiBackend, Closure $hasPermission, Closure $getPdnsServerInfo, Closure $getDebugQueries, bool $wideLayout, SessionInterface $session, Closure|null $pendingChangeRequestCount = null)

No description

Parameters

AppManager $app
ConfigurationInterface $config
CsrfTokenService $csrfTokenService
UserContextService $userContextService
ModuleRegistry $moduleRegistry

Already loaded; the renderer only reads its nav items

bool $isApiBackend

Whether zones live behind the PowerDNS API (enables the API error banner)

Closure $hasPermission
Closure $getPdnsServerInfo

Returns the session-cached PowerDNS server info (array or null), read at first render

Closure $getDebugQueries
bool $wideLayout
SessionInterface $session
Closure|null $pendingChangeRequestCount

void renderPage(string $template, array $params, array $requestData, string $pageTitle, array|null $systemMessages, array|null $scriptMessages)

A full page: the chrome, then $template rendered with $params.

Parameters

string $template
array $params

The template variables as the controller built them

array $requestData

The request data, read for the current page marker

string $pageTitle
array|null $systemMessages

Messages flashed for every page

array|null $scriptMessages

Messages flashed for this page

Return Value

void

void renderChrome(array $requestData, string $pageTitle, array|null $systemMessages)

The chrome alone, which is how an error page shows its system messages.

Parameters

array $requestData
string $pageTitle
array|null $systemMessages

Return Value

void

void renderHeader(array $requestData, string $pageTitle, array|null $systemMessages = null, array|null $scriptMessages = null)

Renders the header of the page.

Parameters

array $requestData

The controller's request data (current page, form state)

string $pageTitle

Page title, or '' to fall back to the interface title

array|null $systemMessages

System messages to be displayed

array|null $scriptMessages

Return Value

void

void renderFooter()

Renders the footer of the page.

Return Value

void

array languageVars()

Language selector variables for the current request, built once and shared by the header dropdown, the page body (login form's hidden userlang field), and any later render call in the same request.

Return Value

array

array getLanguageSelectorVars(string $activeLocale)

Build the login-page language selector variables: the active locale, the dropdown options, and a visibility flag. Shared by the header dropdown and the login form's hidden userlang field so the chosen language survives form submission.

Parameters

string $activeLocale

Return Value

array

string resolveActiveLocale()

Returns the locale the translator was built with, so rendered strings and the page's lang metadata always agree.

Return Value

string