paragraphs-summary.html.twig 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a paragraphs summary.
  5. *
  6. * Available variables:
  7. * - expanded: Whether the summary is expanded or not.
  8. * - content: Array of content summary items.
  9. * - behaviors: Array of behavior summary items.
  10. *
  11. * @see template_preprocess()
  12. *
  13. * @ingroup themeable
  14. */
  15. #}
  16. {% set classes = [
  17. 'paragraphs-description',
  18. expanded ? 'paragraphs-expanded-description' : 'paragraphs-collapsed-description'
  19. ] %}
  20. {% set label_classes = [
  21. 'field_title'
  22. ] %}
  23. {% spaceless %}
  24. {% if content is not empty or behaviors is not empty %}
  25. {# <div{{ attributes.addClass(classes) }}> #}
  26. {% if content is not empty %}
  27. {# <div class="paragraphs-content-wrapper"> #}
  28. {%- for content_item in content -%}
  29. <span {{ attributes.addClass(label_classes) }}>{{ content_item }}</span>
  30. {%- if not loop.last -%}, {% endif %}
  31. {%- endfor -%}
  32. {# </div> #}
  33. {% endif %}
  34. {% if behaviors is not empty %}
  35. <div class="paragraphs-plugin-wrapper">
  36. {%- for behavior_item in behaviors -%}
  37. <span class="summary-plugin">
  38. {%- if behavior_item.label is not null -%}
  39. <span class="summary-plugin-label">{{ behavior_item.label }}</span>
  40. {%- endif -%}
  41. {{ behavior_item.value -}}
  42. </span>
  43. {%- endfor -%}
  44. </div>
  45. {% endif %}
  46. {# </div> #}
  47. {% endif %}
  48. {% endspaceless %}