Skip to content

feat: Convert legacy templates to twig#399

Merged
kimpepper merged 6 commits into
opensearch-project:mainfrom
kimpepper:twig-templates
Mar 13, 2026
Merged

feat: Convert legacy templates to twig#399
kimpepper merged 6 commits into
opensearch-project:mainfrom
kimpepper:twig-templates

Conversation

@kimpepper
Copy link
Copy Markdown
Collaborator

Description

This moves from legacy templates that use str_replace() to twig. Twig has a number of advantages including:

  • conditional logic {% if %}
  • loops {% for %}
  • nested variables e.g. {{ myobject.property }}
  • inheritance {% extends "base.php" %}
  • template re-use {% block foo %}

This can simplify our current logic, and move simple if statements and loops to the templates themselves in the future.

Note: this introduced some extra whitespace, but our php-cs fixer did not seem to mind.

Issues Resolved

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Kim Pepper <kim@pepper.id.au>
Signed-off-by: Kim Pepper <kim@pepper.id.au>
Signed-off-by: Kim Pepper <kim@pepper.id.au>
Comment thread composer.json Outdated
Signed-off-by: Kim Pepper <kim@pepper.id.au>
shyim
shyim previously approved these changes Mar 12, 2026
@shyim
Copy link
Copy Markdown
Collaborator

shyim commented Mar 12, 2026

Thank you!

Signed-off-by: Kim Pepper <kim@pepper.id.au>
Signed-off-by: Kim Pepper <kim@pepper.id.au>
@kimpepper kimpepper requested a review from shyim March 12, 2026 23:57
@kimpepper kimpepper merged commit fd19402 into opensearch-project:main Mar 13, 2026
31 checks passed
@kimpepper kimpepper deleted the twig-templates branch March 13, 2026 04:48
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.

2 participants