Skip to content

Register Twig extensions for all requests in the example - #809

Closed
alvaroalonsoparrondo-a11y wants to merge 1 commit into
craftcms:mainfrom
alvaroalonsoparrondo-a11y:twig-extension-all-requests
Closed

alvaroalonsoparrondo-a11y wants to merge 1 commit into
craftcms:mainfrom
alvaroalonsoparrondo-a11y:twig-extension-all-requests

Conversation

@alvaroalonsoparrondo-a11y

Copy link
Copy Markdown
Contributor

Fixes #790.

The "Registering the Extension" example wrapped the registration in getIsSiteRequest() and called that check optional. Site templates are also rendered in control panel requests (CKEditor renders nested entries' partial templates there, see craftcms/ckeditor#248), so following the example can break those templates with an unknown function or filter.

The example now registers the extension unconditionally, and the paragraph after it says why, and that a request check is only for extensions that must stay out of other contexts. Same change in the 4.x and 5.x pages.

@alvaroalonsoparrondo-a11y
alvaroalonsoparrondo-a11y requested a review from a team as a code owner November 24, 2026 22:23
@netlify

netlify Bot commented Nov 24, 2026

Copy link
Copy Markdown

👷 Deploy request for craft-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 325b172

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.

[Content]: Revise "Extending Twig" > "Registering the Extension"

2 participants