Allow dynamic option change during runtime #217
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.
Hi @shakaran ,
another PR with two non BC break changes:
The Service alias is required for auto-wiring via constructor annotation.
Using the context helper allows us to change the body class options during runtime.
Use-Case: I added a EventSubscriber that listen on the
kernel.controller
even, which dynamically loads theskin
and other options (likeboxed_layout
) from a user db. I usedContextHelper->setOption()
but the options were not applied in the twig template.Now in works like that (adapted for demo):
Why? Currently in master the Twig helper gets a static copy of the options array, where another copy is injected into the ContextHelper. This builds the internal options from that copy & the user config but doesn't use it (at least not in the TwigExtensions helper).
I believe this is a programmatically bug or I completely misunderstood the ContextHelper?!?