Solution:
{{ dump() }}
displays all variables.
---
cant get {{_self}} to function in the frontend branch throws an error when used:
twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Object of type "__TwigTemplate_6e62bf61c51b42082c46ee1f4d61501d" cannot be printed.") in "core/themes/stark/templates/system/breadcrumb.twig" at line 15. in Twig_Template->displayWithErrorHandling() (line 269 of /Users/mortendk/Dropbox/websites/drupal8twig/core/vendor/twig/twig/lib/Twig/Template.php).
Comments
Comment #1
fabianx commentedFor what do you need {{ _self }} printed?
Comment #2
mortendk commentedits nice to know what vars that are available ;)
else were kinda working in darkness arent we ?
right now im working on the breadcrumb function, so i wanted to know what the vars were called etc
Comment #3
fabianx commentedPlease use:
instead. That will give the vars available.
Leaving as active, so others can find it.
Comment #4
fabianx commentedYou can also use kpr, dpr, dsm, etc. if devel module for D8 is downloaded and enabled. psynaptic took care of that.
Comment #5
mortendk commentedawesome!!
Comment #6
anthonyR commentedLifesaver, thanks!
Comment #7
jenlamptonCan we use this solution for #1783134: [META] Make it possible to inspect twig variables and get information about objects and render arrays?
marking as dupe.
Comment #8
fabianx commentedOthers need to find this issue, re-opening as a pure support request.
Comment #9
johnalbinThe issue summary says to use
{{ dump() }}, while Fabian's comment #4 says to use{{ dump(_context) }}. Are they equivalent? It's unclear.Comment #10
fabianx commentedThey are equivalent according to docs.
Comment #11
johnalbinThanks for the clarification. Then, I'll leave the issue summary as-is. :-)
Comment #12
steveoliver commentedJohnAlbin:
{{ dump() }}appears to use_contextby default;{{ dump() }}outputs the same as{{ dump(_context) }}for me.From Twig's docs on templates + a few inline notes from my observations:
_selfreferences the current template -- it contains variables about a template, i.e. its filename and available Twigblocks;_context: references the current context -- it contains variables for a template such as variables sent from theme(), prepared by preprocess, or set in the template;_charset: references the current charset.Comment #13
webthingee commentedUntil there is a way to use dsm, dpr, kpr
I am starting to find that what works well for me is..
Comment #13.0
webthingee commentedAdd dump() function
Comment #14
berdirThis was referenced in http://drupal.stackexchange.com/questions/98014/devel-dsm-function-in-dr....
Would be great if someone in here could provide a more complete and detailed answer about what's currently available and possible. Easier to find than an issue and can be moved into d.o documentation later on.
Comment #15
star-szrPosted an answer there, thanks @Berdir. See #2218949: Add Kint functionality to Twig templates, I hope we get tons of debugging options on contrib :)