Skip to content

refactor(templating): add TemplateRenderer interface - #1976

Merged
JohnVillalovos merged 1 commit into
mainfrom
jlvillal/twig
Nov 19, 2026
Merged

JohnVillalovos merged 1 commit into
mainfrom
jlvillal/twig

Conversation

@JohnVillalovos

Copy link
Copy Markdown
Collaborator

Add the interface that the Smarty and Twig renderers will both implement, so pages, controls and emails can render through either engine without knowing which one is in use.

The interface follows what SmartyPage offers today (assigning variables, fetching and displaying templates, localized and control templates, validators) rather than a minimal rendering contract, so call sites can move to it with few changes.

This is groundwork only. Nothing implements the interface yet, and some callers use Smarty-specific methods it does not cover, such as the reservation formatting helpers and the resource image responses. Those still have to be migrated.

Assisted-by: Claude:claude-fable-5-2

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A critical interface-design issue remains because its typed method contracts conflict with the case-insensitive, legacy SmartyPage API, preventing intended implementations from satisfying the interface.

1 open issue
What changed in this PR

Adds a TemplateRenderer interface to provide an engine-neutral contract for future Smarty and Twig integrations across pages, controls, and emails.

Changes:

  • Defines variable assignment and template rendering methods.
  • Adds localized, template-directory, and control-template operations.
  • Exposes validator access and validation status.
File Description
src/​Common/​Templating/​TemplateRenderer.php Introduces the shared template-rendering interface for future Smarty and Twig implementations.

Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The change still has an active moderate contract issue that may let implementations silently return content in the wrong language when a requested locale differs.

1 open issue
1 resolved since last review

Review effort: Lite

Add the interface that the Smarty and Twig renderers will both
implement, so pages, controls and emails can render through either
engine without knowing which one is in use.

The interface follows what SmartyPage offers today (assigning
variables, fetching and displaying templates, localized and control
templates, validators) rather than a minimal rendering contract, so
call sites can move to it with few changes.

This is groundwork only. Nothing implements the interface yet, and
some callers use Smarty-specific methods it does not cover, such as
the reservation formatting helpers and the resource image responses.
Those still have to be migrated.

Assisted-by: Claude:claude-fable-5-2

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human review is needed because the foundational interface lacks renderer implementations and contract tests to confirm that the planned Smarty and Twig adapters honor its cross-engine state, localization, control-template, and validation semantics.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@JohnVillalovos
JohnVillalovos enabled auto-merge (rebase) November 19, 2026 01:38
@JohnVillalovos
JohnVillalovos merged commit 0dff053 into main Nov 19, 2026
14 checks passed
@JohnVillalovos
JohnVillalovos deleted the jlvillal/twig branch November 19, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants