I have created a view with table format but i am not able to print field variables in twig template of view suppose machine name of eck field is field_large,field_quote_source and so on.

 <ul class="bxslider">
  {% for row in rows %}
<li{{ row.attributes }}>
  {% for key, column in row.columns %}
        {% for content in column.content %}
          {{- content.separator }}{{ content.field_output -}}
          {{ content.field_large }}
        {% endfor %}                  
  {% endfor %}
 {% endfor %}

This is the path for accessing single fields in a view table template, for example in the first row:


In your code example, to get all field names available, use this in the first loop:

{{ dump(row.columns|keys) }}

The naming of the fields depends on how you have configured the view and is not necessarily the machine name of the field in the entity.

  • Thank you so much ,but what is the logic behind this ,our drupal 8 concept is not so clear ,can you suggest me some tutorial links – user59414 Jun 28 '17 at 7:12
  • Can you put the above line of code into loop ,again i am stucked – user59414 Jun 28 '17 at 7:29
  • 1
    This line is only to show where you can find the field names. If you really want to work on this view template use xdebug, why and how to use xdebug is described in the official documentation drupal.org/docs/8/theming/twig/debugging-twig-templates – 4k4 Jun 28 '17 at 7:54

Your Answer

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