The Game Panel specification

ADR-0019: Twig is the template engine

Context

The panel is one server-rendered system, per ADR-0001, so the engine has to turn templates into HTML.

Pages are not rendered whole every time. Hypermedia interactions swap a fragment of a page in place, so a named region of a template has to be renderable on its own.

Templates come from more than one place. Core provides them, modules provide their own, and a theme replaces any of them, so a reference has to resolve through an ordered chain of locations rather than one directory.

Module authors write templates, so the engine’s choice is one they have to work in.

Decision

Twig is the panel’s template engine. Templates are Twig templates, resolved through Twig’s own loader, and rendering goes through a Twig environment built once when the panel boots.

Alternatives

Other template engines. Several were weighed, though the record does not name them. Twig was chosen for its sandboxing and its flexibility, and because module authors are more likely to know it than any alternative.

Consequences

Easier:

Harder:

Constrained:

Sources