[6.x] Implement template renderers using Laravel manager#19290
Merged
Conversation
📚 Storybook previews@craftcms/ui — open Storybook No changed components detected in this Storybook. resources/js — open Storybook No changed components detected in this Storybook. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the custom “manager-like” template renderer selection with a Laravel Manager-based TemplateManager, and updates Twig/Blade rendering entry points, contracts, events, tests, and docs to match the new architecture.
Changes:
- Introduces
CraftCms\Cms\View\TemplateManager(scoped) plus aTemplatefacade, using Laravel Manager semantics for renderer registration/caching and auto-selection by resolved file. - Refactors template rendering APIs/contracts/events to align with the manager (incl. new
TwigRendererInterface, updatedTemplateRendered/PageTemplateRenderedpayloads). - Updates call sites, helpers, adapter shims, tests, and documentation to use
TemplateManager/Templateinstead of the removedTemplateRenderer/BaseTemplateRenderer.
Reviewed changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yii2-adapter/tests-laravel/View/CraftVariableCompatibilityTest.php | Switches compatibility test to TemplateManager. |
| yii2-adapter/legacy/web/View.php | Updates deprecated Yii-era view methods to delegate to Template/TemplateManager. |
| tests/Unit/View/TwigEngineTest.php | Adjusts Twig engine tests to new rendering path and resets Template facade state. |
| tests/Unit/View/TemplateRendererTest.php | Removes tests for deleted TemplateRenderer. |
| tests/Unit/View/TemplateManagerTest.php | Adds coverage for manager renderer resolution/selection/caching behavior. |
| tests/Unit/View/TemplateManagerLifecycleTest.php | Adds coverage for manager render state + lifecycle/event ordering. |
| tests/Unit/View/BladeRendererTest.php | Routes Blade rendering tests through TemplateManager. |
| tests/Unit/View/BaseTemplateRendererTest.php | Removes tests for deleted BaseTemplateRenderer. |
| tests/Unit/Twig/TwigRendererTest.php | Updates Twig renderer tests to use TemplateManager APIs. |
| tests/Unit/Twig/TwigExceptionMapperTest.php | Updates nested render test to new manager class paths. |
| tests/Unit/Twig/Tags/TagTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/SwitchTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/RequireEditionTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/RegisterResourceTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/RedirectTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/NavTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/NamespaceTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/HookTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/HeaderTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/HasSomeHasEveryTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/ExpiresTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/ExitTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/DeprecatedTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Tags/CacheTagTest.php | Switches tag rendering tests to TemplateManager. |
| tests/Unit/Twig/Extensions/LaravelExtensionTest.php | Updates Twig blade() function test to TemplateManager. |
| tests/Unit/HelpersTest.php | Updates helpers to support explicit renderer selection (TemplateEngine). |
| tests/Feature/Twig/Tags/RequireLoginGuestTagTest.php | Switches feature tests to TemplateManager. |
| tests/Feature/Twig/Tags/RequireAuthTagTest.php | Switches feature tests to TemplateManager. |
| tests/Feature/Twig/Tags/PaginateTagTest.php | Switches feature tests to TemplateManager. |
| tests/Feature/Field/MarkdownFieldTest.php | Updates Twig string rendering in Markdown field test to manager API. |
| src/View/TwigEngine.php | Routes Twig engine rendering through Template facade + explicit Twig engine. |
| src/View/TemplateRenderer.php | Removes legacy renderer-selection class. |
| src/View/TemplateManager.php | Adds Laravel Manager-based template manager (core change). |
| src/View/PageLifecycle.php | Updates doc wording to reflect TemplateManager. |
| src/View/Events/TemplateRendering.php | Updates before-event payload (no renderer identity). |
| src/View/Events/TemplateRenderersResolving.php | Removes legacy renderer-discovery event. |
| src/View/Events/TemplateRendered.php | Updates after-event payload to include final rendererName. |
| src/View/Events/PageTemplateRendering.php | Updates before-event payload (no renderer identity). |
| src/View/Events/PageTemplateRendered.php | Updates after-event payload to include final rendererName. |
| src/View/Contracts/TemplateRendererInterface.php | Simplifies renderer contract to file+string rendering. |
| src/View/BaseTemplateRenderer.php | Removes legacy base renderer implementation. |
| src/Twig/TwigRenderer.php | Adapts Twig renderer to new contracts (manager owns lifecycle/state). |
| src/Twig/NodeVisitors/EventTagFinder.php | Uses Template facade for page-render detection. |
| src/Twig/NodeVisitors/EventTagAdder.php | Uses Template facade for page-render detection. |
| src/Twig/Extensions/LaravelExtension.php | Updates Twig blade() helper to resolve via Template. |
| src/Twig/Contracts/TwigRendererInterface.php | Adds Twig-specific renderer contract. |
| src/SystemMessage/Actions/FormatSystemMessageMailAction.php | Uses TemplateManager (explicit Twig engine) for system mail template rendering. |
| src/Support/Facades/Template.php | Adds Template facade for TemplateManager. |
| src/Route/TemplateRoute.php | Routes front-end template requests through Template facade. |
| src/helpers.php | Updates template helpers to call Template and allow explicit renderer selection. |
| src/Blade/BladeRenderer.php | Adapts Blade renderer to new renderer contract (manager owns lifecycle/state). |
| docs/blade.md | Documents TemplateManager/Template facade and renderer extension semantics. |
| composer.json | Updates CI pint invocation (adds --parallel). |
| CHANGELOG.md | Notes new manager, facade, contracts, and event payload changes. |
riasvdv
marked this pull request as ready for review
July 22, 2026 11:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Instead of our own manager-like system, use what Laravel provides for us and implement the template renderers using Laravel's manager concept.