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

Fabianx’s picture

Status: Active » Postponed (maintainer needs more info)

For what do you need {{ _self }} printed?

mortendk’s picture

its 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

Fabianx’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Active

Please use:

{{ dump(_context) }}

instead. That will give the vars available.

Leaving as active, so others can find it.

Fabianx’s picture

Title: {{ _self }} in the frontend » {{ _self }} in the frontend => How do I dump or debug things?

You can also use kpr, dpr, dsm, etc. if devel module for D8 is downloaded and enabled. psynaptic took care of that.

mortendk’s picture

awesome!!

anthonyR’s picture

Lifesaver, thanks!

jenlampton’s picture

Status: Active » Closed (duplicate)
Fabianx’s picture

Status: Closed (duplicate) » Active

Others need to find this issue, re-opening as a pure support request.

JohnAlbin’s picture

Component: Twig templates » Twig templates conversion (front-end branch)

The issue summary says to use {{ dump() }}, while Fabian's comment #4 says to use {{ dump(_context) }}. Are they equivalent? It's unclear.

Fabianx’s picture

They are equivalent according to docs.

JohnAlbin’s picture

Thanks for the clarification. Then, I'll leave the issue summary as-is. :-)

steveoliver’s picture

JohnAlbin: {{ dump() }} appears to use _context by default; {{ dump() }} outputs the same as {{ dump(_context) }} for me.

From Twig's docs on templates + a few inline notes from my observations:

  • _self references the current template -- it contains variables about a template, i.e. its filename and available Twig blocks;
  • _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.
webthingee’s picture

Until there is a way to use dsm, dpr, kpr
I am starting to find that what works well for me is..


<pre style="overflow: scroll; height: 300px">
{{ dump(_self) }}
</pre>

webthingee’s picture

Issue summary: View changes

Add dump() function

Berdir’s picture

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

star-szr’s picture

Issue summary: View changes

Posted an answer there, thanks @Berdir. See #2218949: Add Kint functionality to Twig templates, I hope we get tons of debugging options on contrib :)