You are here

views-bootstrap-list-group.html.twig in Views Bootstrap 8.3

Same filename and directory in other branches
  1. 8.4 templates/views-bootstrap-list-group.html.twig

views-bootstrap-list-group.html.twig Default simple view template to display Bootstrap List Group.

Available variables:

  • view: The view object.
  • rows: A list of the view's row items.
  • id: A valid HTML ID and guaranteed to be unique.

File

templates/views-bootstrap-list-group.html.twig
View source
  1. {#
  2. /**
  3. * @file views-bootstrap-list-group.html.twig
  4. * Default simple view template to display Bootstrap List Group.
  5. *
  6. * Available variables:
  7. * - view: The view object.
  8. * - rows: A list of the view's row items.
  9. * - id: A valid HTML ID and guaranteed to be unique.
  10. *
  11. * @see template_preprocess_views_bootstrap_list_group()
  12. *
  13. * @ingroup views_templates
  14. */
  15. #}
  16. {% set div_classes = [] %}
  17. {% set heading_classes = [] %}
  18. {% if panels %}
  19. {% set div_classes = div_classes|merge(['panel', 'panel-default']) %}
  20. {% set heading_classes = heading_classes|merge(['panel-heading']) %}
  21. {% endif %}
  22. {%
  23. set classes = [
  24. 'views-view-list-group',
  25. 'list-group',
  26. ]
  27. %}
  28. {% set title_attributes = create_attribute({'class': ['accordion-toggle', 'collapsed']}) %}
  29. {% if group_title %}<div{{ create_attribute({'class': div_classes}) }}>{% endif %}
  30. {% if group_title %}<div{{ create_attribute({'class': heading_classes}) }}><h4>{{ group_title }}</h4></div>{% endif %}
  31. <ul id="{{ id }}" {{ attributes.addClass(classes) }}>
  32. {% for key, row in rows %}
  33. <li class="list-group-item">
  34. {% if row.title %}
  35. <h4 class="list-group-item-heading">{{ row.title }}</h4>
  36. {% endif %}
  37. <p class="list-group-item-text">{{ row.content }}</p>
  38. </li>
  39. {% endfor %}
  40. </ul>
  41. {% if group_title %}</div>{% endif %}