0

On my site, I'm able to use print variables using kint in my pre-process functions.

However, when I try to do the same in twig, nothing happens. I do have debug mode turned on. Has anyone ever ran into this fact pattern? Any ideas?

To clarify:

  • It does not work in any of my templates
  • The specific template I'm using is for styling the output of a view, which is a page and has unformatted HTML as its type.

This is how I use kint kint()

This is what I have seen on tutorials.

  • Without seeing how you actually use is, we can't say what's wrong. Please update your question to include code snippets of what you are trying to do and WHERE. What file? What template? What code? – leymannx Oct 8 '18 at 14:53
  • 2
    Just to make sure that you know, you do like this to kint in twig, {{ kint(variable) }} – user72672 Oct 8 '18 at 15:02
  • Jdrupal, I will be happy to let you know once I test. I have had to work on other things and have not yet tested. – Scott Oct 10 '18 at 21:28
1

In php you use kint like this, kint($variable), but in twig you use kint like this, {{ kint(variable) }}.

This is the only problem I can spot by looking at your question.

Hope it helps.

| improve this answer | |
  • In PHP I'd recommend ksm($variable) which will print the output into the Status messages block (in D7 this was dpm($variable)). – leymannx Oct 8 '18 at 16:24
  • When I try to "kint" the "item" variable in a loop, I get a white screen. – Scott Oct 15 '18 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.