`default.context` not available in (twig) preview templates
See original GitHub issueglobal.context
data is not made available to (twig) preview templates.
This used to work with version 1.1.x of fractal.
Steps to reproduce the issue
- set a global context
fractal.components.set('default.context', {
manifest: {
'main.js': 'main.h65dd5.js',
}
})
- use the context in a preview template
{{ dump(manifest['main.js']) }}
- output is
undefined
. It should bemain.h65dd5.js
.
Reproduces how often:
100%
Reduced test case
https://gist.github.com/therealpecus/a9ba99ddff7b0ebecf1cd39871c3e68d
Context
- Fractal version: @frctl/fractal@1.5.8
- Twig adapter: @frctl/twig@1.2.9
- Node version: v14.16.1
- OS: Mac OS 10.15.7
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Debugging Twig templates | Twig in Drupal
The Twig template engine offers a debug tool. ... If services.yml does not yet exist; copy default.services.yml to services.yml . If Drupal has...
Read more >Twig for Template Designers - Documentation - Twig - The ...
The following variables are always available in templates: _self : references the current template name;; _context : references the current context; ...
Read more >How to use preview templates? · Issue #1 · tnottu/fractal-twig ...
I got these errors: Error parsing twig template @preview: TwigException: include function does not exist and is not defined in the context Jeroen....
Read more >How to retrieve all Variables from a Twig Template?
So you can get all variables from current context calling dump() without any ... creating your Twig environment because dump() isn't available by...
Read more >Use a different twig media template if it is being rendered ...
You could check for the route name media.filter.preview : if (\Drupal::routeMatch()->getRouteName() === 'media.filter.preview') { // media ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had missed it! I’ll review the PR
I’d still categorize this as a bug / unexpected behavior, it’s just that since it’s not a regression and has worked this way since 2016, it gets a little bit lower priority.