question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`default.context` not available in (twig) preview templates

See original GitHub issue

global.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

  1. set a global context
fractal.components.set('default.context', {
	manifest: {
		'main.js': 'main.h65dd5.js',
	}
})
  1. use the context in a preview template
{{ dump(manifest['main.js']) }}
  1. output is undefined. It should be main.h65dd5.js.

Reproduces how often:

100%

Reduced test case

https://gist.github.com/therealpecus/a9ba99ddff7b0ebecf1cd39871c3e68d

Context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
therealpecuscommented, Jul 2, 2021

Help out with testing / reviewing the fix in the PR linked above! If noone tells us it’s better with the fix, it’ll never get merged/released.

Or, if the fix does not solve the issues, more info is needed to investigate further.

I had missed it! I’ll review the PR

1reaction
mihkeleidastcommented, May 26, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found