views-view-fields.html.twig 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {#
  2. /**
  3. * @file
  4. * Theme override 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. #}
  32. {% for field in fields -%}
  33. {{ field.separator }}
  34. {%- if field.wrapper_element -%}
  35. <{{ field.wrapper_element }}{{ field.wrapper_attributes }}>
  36. {%- endif %}
  37. {%- if field.label -%}
  38. {%- if field.label_element -%}
  39. <{{ field.label_element }}{{ field.label_attributes }}>{{ field.label }}{{ field.label_suffix }}</{{ field.label_element }}>
  40. {%- else -%}
  41. {{ field.label }}{{ field.label_suffix }}
  42. {%- endif %}
  43. {%- endif %}
  44. {%- if field.element_type -%}
  45. <{{ field.element_type }}{{ field.element_attributes }}>{{ field.content }}</{{ field.element_type }}>
  46. {%- else -%}
  47. {{ field.content }}
  48. {%- endif %}
  49. {%- if field.wrapper_element -%}
  50. </{{ field.wrapper_element }}>
  51. {%- endif %}
  52. {%- endfor %}