views-view-fields.html.twig

Same filename in this branch
  1. 11.x core/themes/stable9/templates/views/views-view-fields.html.twig
  2. 11.x core/modules/views/tests/themes/views_test_theme/templates/views-view-fields.html.twig
Same filename in other branches
  1. 9 core/themes/stable9/templates/views/views-view-fields.html.twig
  2. 9 core/themes/stable/templates/views/views-view-fields.html.twig
  3. 9 core/modules/views/tests/themes/views_test_theme/templates/views-view-fields.html.twig
  4. 9 core/modules/views/templates/views-view-fields.html.twig
  5. 8.9.x core/themes/stable/templates/views/views-view-fields.html.twig
  6. 8.9.x core/modules/views/tests/themes/views_test_theme/templates/views-view-fields.html.twig
  7. 8.9.x core/modules/views/templates/views-view-fields.html.twig
  8. 10 core/themes/stable9/templates/views/views-view-fields.html.twig
  9. 10 core/modules/views/tests/themes/views_test_theme/templates/views-view-fields.html.twig
  10. 10 core/modules/views/templates/views-view-fields.html.twig

Default view template to display all the fields in a row.

Available variables:

  • view: The view in use.
  • fields: A list of fields, each one contains:
    • content: The output of the field.
    • raw: The raw data for the field, if it exists. This is NOT output safe.
    • class: The safe class ID to use.
    • handler: The Views field handler controlling this field.
    • inline: Whether or not the field should be inline.
    • wrapper_element: An HTML element for a wrapper.
    • wrapper_attributes: List of attributes for wrapper element.
    • separator: An optional separator that may appear before a field.
    • label: The field's label text.
    • label_element: An HTML element for a label wrapper.
    • label_attributes: List of attributes for label wrapper.
    • label_suffix: Colon after the label.
    • element_type: An HTML element for the field content.
    • element_attributes: List of attributes for HTML element for field content.
    • has_label_colon: A boolean indicating whether to display a colon after the label.
    • element_type: An HTML element for the field content.
    • element_attributes: List of attributes for HTML element for field content.
  • row: The raw result from the query, with all data it fetched.

See also

template_preprocess_views_view_fields()

File

core/modules/views/templates/views-view-fields.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Default view template to display all the fields in a row.
  5. *
  6. * Available variables:
  7. * - view: The view in use.
  8. * - fields: A list of fields, each one contains:
  9. * - content: The output of the field.
  10. * - raw: The raw data for the field, if it exists. This is NOT output safe.
  11. * - class: The safe class ID to use.
  12. * - handler: The Views field handler controlling this field.
  13. * - inline: Whether or not the field should be inline.
  14. * - wrapper_element: An HTML element for a wrapper.
  15. * - wrapper_attributes: List of attributes for wrapper element.
  16. * - separator: An optional separator that may appear before a field.
  17. * - label: The field's label text.
  18. * - label_element: An HTML element for a label wrapper.
  19. * - label_attributes: List of attributes for label wrapper.
  20. * - label_suffix: Colon after the label.
  21. * - element_type: An HTML element for the field content.
  22. * - element_attributes: List of attributes for HTML element for field content.
  23. * - has_label_colon: A boolean indicating whether to display a colon after
  24. * the label.
  25. * - element_type: An HTML element for the field content.
  26. * - element_attributes: List of attributes for HTML element for field content.
  27. * - row: The raw result from the query, with all data it fetched.
  28. *
  29. * @see template_preprocess_views_view_fields()
  30. *
  31. * @ingroup themeable
  32. */
  33. #}
  34. {% for field in fields -%}
  35. {{ field.separator }}
  36. {%- if field.wrapper_element -%}
  37. <{{ field.wrapper_element }}{{ field.wrapper_attributes }}>
  38. {%- endif %}
  39. {%- if field.label -%}
  40. {%- if field.label_element -%}
  41. <{{ field.label_element }}{{ field.label_attributes }}>{{ field.label }}{{ field.label_suffix }}</{{ field.label_element }}>
  42. {%- else -%}
  43. {{ field.label }}{{ field.label_suffix }}
  44. {%- endif %}
  45. {%- endif %}
  46. {%- if field.element_type -%}
  47. <{{ field.element_type }}{{ field.element_attributes }}>{{ field.content }}</{{ field.element_type }}>
  48. {%- else -%}
  49. {{ field.content }}
  50. {%- endif %}
  51. {%- if field.wrapper_element -%}
  52. </{{ field.wrapper_element }}>
  53. {%- endif %}
  54. {%- endfor %}

Related topics


Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.