Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for collecting encore entrypoints via Contao’s ResponseContext (with an EntryBag), and updates entry injection to work with deferred rendering in modern layouts.
Changes:
- Introduces
HeimrichHannot\EncoreBundle\Request\ResponseContext\Entry+EntryBagand wires them intoFrontendAsset/EntryPointsBuilder. - Updates listeners (
InjectPageEntriesListener,ReplaceDynamicScriptTagsListener) to useResponseContextAccessorinstead ofFrontendAsset. - Updates docs, twig collector template styling, phpstan baseline, and adds/adjusts tests for the new behavior.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/EventListener/InjectPageEntriesListenerTest.php | Adds coverage for deferred loading via response_context and “regular page” early return. |
| tests/EventListener/Contao/ReplaceDynamicScriptTagsListenerTest.php | Updates test to pass ResponseContext into the builder via ResponseContextAccessor. |
| tests/EntryPoint/EntryPointsBuilderTest.php | Migrates from FrontendAsset to ResponseContext/EntryBag and asserts new behavior. |
| tests/Asset/PageEntrypointsTest.php | Adapts test setup to new FrontendAsset(ResponseContextAccessor) constructor. |
| tests/Asset/FrontendAssetTest.php | Adds tests for behavior with/without a ResponseContext. |
| src/Request/ResponseContext/EntryBag.php | New container for response-context entry registrations. |
| src/Request/ResponseContext/Entry.php | New DTO for entry registrations (name/origin/extension). |
| src/EventListener/InjectPageEntriesListener.php | Implements deferred injection by wrapping response_context and triggering on end_of_head access. |
| src/EventListener/Contao/ReplaceDynamicScriptTagsListener.php | Switches to response context for building entrypoints. |
| src/EntryPoint/EntryPointsBuilder.php | Adds response-context and “custom bag” sources for building entrypoints. |
| src/EntryPoint/EntryPoint.php | Adds fromEntry() helper for converting Entry → EntryPoint. |
| src/Asset/FrontendAsset.php | Reworks active entrypoint tracking to store entries in ResponseContext (EntryBag). |
| phpstan-baseline.neon | Updates baseline counts for additional LayoutEvent accessors usage. |
| docs/developers/dynamic_entries.md | Documents the new response-context approach for registering entries. |
| docs/developers.md | Updates the “custom template” example to use response context/custom bag. |
| contao/templates/twig/data_collector/huh_encore.html.twig | Adjusts table cell styling in the data collector view. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This PR add custom response context bag for entries
It also adjust the way how entries injected in modern layouts due defered rendering.