AppManager
class AppManager (View source)
Class AppManager
Manages the application configuration, template rendering, and statistics display.
Properties
| protected Environment | $templateRenderer | ||
| protected ConfigurationManager | $configuration | ||
| protected StatsDisplayService|null | $statsDisplayService |
Methods
AppManager constructor.
Fails fast on broken configuration. Static and free of template setup so callers can check before, or without, building the Twig stack.
Gets the theme name that templates are actually served from, which is 'default' when the configured theme directory does not exist.
Gets the theme base path matching the resolved theme, in the relative/URL form used for asset paths in templates.
Registers an extension on the template renderer. Must be called before the first render of the request - Twig locks extensions afterwards.
Registers a global template variable. New names must be registered before the first render of the request; re-registering an existing name afterwards only updates its value.
Renders a template with the given parameters.
Gets the locale the translator was built with. Page chrome must use this (not re-resolve) so rendered strings and lang metadata agree.
Gets the enabled locales as resolved for this request.
Displays the application statistics.
Details
__construct(LoggerInterface|null $logger = null)
AppManager constructor.
Initializes the template renderer, configuration, and optional statistics display service.
static void
assertConfigurationUsable(ConfigurationManager $configuration)
Fails fast on broken configuration. Static and free of template setup so callers can check before, or without, building the Twig stack.
string
getThemeName()
Gets the theme name that templates are actually served from, which is 'default' when the configured theme directory does not exist.
string
getThemeBasePath()
Gets the theme base path matching the resolved theme, in the relative/URL form used for asset paths in templates.
void
addTwigExtension(ExtensionInterface $extension)
Registers an extension on the template renderer. Must be called before the first render of the request - Twig locks extensions afterwards.
void
addTwigGlobal(string $name, mixed $value)
Registers a global template variable. New names must be registered before the first render of the request; re-registering an existing name afterwards only updates its value.
void
render(string $template, array $params = [])
Renders a template with the given parameters.
string
getInterfaceLocale()
Gets the locale the translator was built with. Page chrome must use this (not re-resolve) so rendered strings and lang metadata agree.
array
getSupportedLocales()
Gets the enabled locales as resolved for this request.
string
displayStats()
Displays the application statistics.