Jonas de Herdt Jonas de Herdt - 1 year ago 71
PHP Question

Is there a way to dump 'self', or the container object in a symfony twig template?

I have a twig template that extends from a sonata_block.
But I cant find any variables to dump.

Is there a way to dump the wrapper element, or container?
eg: {{ dump(this)}}, or {{ dump(self)}}

Answer Source

You can list all available variables in twig templates by looping through the _context var :

{% for key, value in _context  %}
    <h2>{{ key }}</h2>
    {{ dump(value) }}
{% endfor %}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download