twigdrupal-8

Dump(item) not working in Twig template drupal


I have twig template for default view

{% for item in items %}
     {{ item.content }}

    {% endfor %}

{{ item.content }} have values but when I tried to print the whole array like

 {% for item in items %}
         {{ item }}

        {% endfor %}

It is not working. I have enabled (service.yml)

debug true
cache false
autoload true 

but it's not working. Any help would be appreciated


Solution

  • Try and install the Devel plugin with its Kint extension. Once you have both running you could use: {{kint(item.content)}} to get a full list of all items within the content array.

    Below an example of the kint() output.

    Example of an kint() dump

    As both are development plugins, they should only be used for debugging and not be installed on a production website.