Skip to content

feat: add layouts.autoescape option#2388

Merged
ArnaudLigny merged 5 commits into
masterfrom
autoescape
May 28, 2026
Merged

feat: add layouts.autoescape option#2388
ArnaudLigny merged 5 commits into
masterfrom
autoescape

Conversation

@ArnaudLigny
Copy link
Copy Markdown
Member

@ArnaudLigny ArnaudLigny commented May 28, 2026

This pull request adds support for configuring the Twig autoescape option for layouts, allowing users to set it explicitly or use an automatic strategy based on the template file extension. The documentation is updated in both English and French to explain the new configuration option and its behaviors.

Configuration and rendering improvements:

  • Added a new layouts.autoescape option to config/default.php, allowing users to control Twig's autoescape behavior for templates. Setting it to null enables an extension-based strategy.
  • Updated the Twig renderer in src/Renderer/Twig.php to use the new layouts.autoescape configuration. If set to null, it determines the escaping strategy based on the template's extension (js, css, html, or none).

Documentation updates:

  • Documented the new layouts.autoescape option and its usage in the English configuration guide (docs/4-Configuration.md).
  • Added equivalent documentation in the French configuration guide (docs/4-Configuration.fr.md).

Introduce a new layouts.autoescape configuration to control Twig's autoescape behavior. The default config value is set in config/default.php, and the Twig renderer now reads this setting; if the value is null the renderer falls back to an extension-based strategy (js -> js, css -> css, html/empty -> html, others -> false). Documentation (English and French) updated with usage examples.
@ArnaudLigny ArnaudLigny marked this pull request as ready for review May 28, 2026 17:39
Copilot AI review requested due to automatic review settings May 28, 2026 17:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new layouts.autoescape configuration path for controlling Twig autoescaping, with renderer support and English/French documentation.

Changes:

  • Reads layouts.autoescape in the Twig renderer and uses an extension-based strategy when the value is null.
  • Adds layouts.autoescape to the default configuration.
  • Documents the option and examples in English and French configuration docs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Renderer/Twig.php Applies the configured Twig autoescape option and defines the null fallback strategy.
config/default.php Adds the default layouts.autoescape config entry.
docs/4-Configuration.md Documents the new option in English.
docs/4-Configuration.fr.md Documents the new option in French.

Comment thread config/default.php
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/Renderer/Twig.php Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread src/Renderer/Twig.php Outdated
Comment thread src/Renderer/Twig.php Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread src/Renderer/Twig.php
Comment thread docs/4-Configuration.md
Comment thread docs/4-Configuration.fr.md
@ArnaudLigny ArnaudLigny merged commit 4702d85 into master May 28, 2026
24 checks passed
@ArnaudLigny ArnaudLigny deleted the autoescape branch May 28, 2026 23:51
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