You are here

semanticviews-row.html.twig in Semantic Views 8.2

{#
 * @file
 * Default simple view template to display all the fields as a row. The template
 * outputs a full row by looping through the $fields array, printing the field's
 * HTML element (as configured in the UI) and the class attributes. If a label
 * is specified for the field, it is printed wrapped in a <label> element with
 * the same class attributes as the field's HTML element.
 *
 * - $view: The view in use.
 * - $fields: an array of $field objects. Each one contains:
 *   - $field.content: The output of the field.
 *   - $field.raw: The raw data for the field, if it exists. This is NOT output
 *     safe.
 *   - $field.element_type: The HTML element wrapping the field content and
 *     label.
 *   - $field.attributes: An array of attributes for the field wrapper.
 *   - $field.handler: The Views field handler object controlling this field.
 *     Do not use var_export to dump this object, as it can't handle the
 *     recursion.
 * - $row: The raw result object from the query, with all data it fetched.
 *
 * @see template_preprocess_semanticviews_view_fields()
 * @ingroup views_templates
 * @todo Justify this template. Excluding the PHP, this template outputs angle
 * brackets, the label element, slashes and whitespace.
#}
{% for field in fields %}

  {% if field.element_type %}
    <{{ field.element_type }} {{ field.attributes }}>
  {% endif %}

    {% if field.label %}

      {% if field.label_element_type %}
        <{{ field.label_element_type }} {{ field.label_attributes }}>
      {% endif %}

          {{ field.label }}{{ field.label_colon }}

      {% if field.label_element_type %}
        </{{ field.label_element_type }}>
      {% endif %}

    {% endif %}

      {{ field.content }}

  {% if field.element_type %}
    </{{ field.element_type }}>
  {% endif %}

{% endfor %}

File

templates/semanticviews-row.html.twig
View source
  1. {#
  2. * @file
  3. * Default simple view template to display all the fields as a row. The template
  4. * outputs a full row by looping through the $fields array, printing the field's
  5. * HTML element (as configured in the UI) and the class attributes. If a label
  6. * is specified for the field, it is printed wrapped in a <label> element with
  7. * the same class attributes as the field's HTML element.
  8. *
  9. * - $view: The view in use.
  10. * - $fields: an array of $field objects. Each one contains:
  11. * - $field.content: The output of the field.
  12. * - $field.raw: The raw data for the field, if it exists. This is NOT output
  13. * safe.
  14. * - $field.element_type: The HTML element wrapping the field content and
  15. * label.
  16. * - $field.attributes: An array of attributes for the field wrapper.
  17. * - $field.handler: The Views field handler object controlling this field.
  18. * Do not use var_export to dump this object, as it can't handle the
  19. * recursion.
  20. * - $row: The raw result object from the query, with all data it fetched.
  21. *
  22. * @see template_preprocess_semanticviews_view_fields()
  23. * @ingroup views_templates
  24. * @todo Justify this template. Excluding the PHP, this template outputs angle
  25. * brackets, the label element, slashes and whitespace.
  26. #}
  27. {% for field in fields %}
  28. {% if field.element_type %}
  29. <{{ field.element_type }} {{ field.attributes }}>
  30. {% endif %}
  31. {% if field.label %}
  32. {% if field.label_element_type %}
  33. <{{ field.label_element_type }} {{ field.label_attributes }}>
  34. {% endif %}
  35. {{ field.label }}{{ field.label_colon }}
  36. {% if field.label_element_type %}
  37. </{{ field.label_element_type }}>
  38. {% endif %}
  39. {% endif %}
  40. {{ field.content }}
  41. {% if field.element_type %}
  42. </{{ field.element_type }}>
  43. {% endif %}
  44. {% endfor %}