paragraphs-summary.html.twig

Default theme implementation for a paragraphs summary.

Available variables:

  • expanded: Whether the summary is expanded or not.
  • content: Array of content summary items.
  • behaviors: Array of behavior summary items.

See also

template_preprocess()

5 theme calls to paragraphs-summary.html.twig
InlineParagraphsWidget::formElement in paragraphs/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php
Uses a similar approach to populate a new translation.
Paragraph::getSummary in paragraphs/src/Entity/Paragraph.php
Returns a short summary for the Paragraph.
ParagraphsSummaryFormatter::viewElements in paragraphs/src/Plugin/Field/FieldFormatter/ParagraphsSummaryFormatter.php
ParagraphsWidget::buildNestedParagraphsFoDragDrop in paragraphs/src/Plugin/Field/FieldWidget/ParagraphsWidget.php
Builds the nested drag and drop structure.
ParagraphsWidget::formElement in paragraphs/src/Plugin/Field/FieldWidget/ParagraphsWidget.php
Uses a similar approach to populate a new translation.

File

paragraphs/templates/paragraphs-summary.html.twig
View source
  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. {% apply spaceless %}
  21. {% if content is not empty or behaviors is not empty %}
  22. <div{{ attributes.addClass(classes) }}>
  23. {% if content is not empty %}
  24. <div class="paragraphs-content-wrapper">
  25. {%- for content_item in content -%}
  26. <span class="summary-content">{{ content_item }}</span>
  27. {%- if not loop.last -%}, {% endif %}
  28. {%- endfor -%}
  29. </div>
  30. {% endif %}
  31. {% if behaviors is not empty %}
  32. <div class="paragraphs-plugin-wrapper">
  33. {%- for behavior_item in behaviors -%}
  34. <span class="summary-plugin">
  35. {%- if behavior_item.label is not null -%}
  36. <span class="summary-plugin-label">{{ behavior_item.label }}</span>
  37. {%- endif -%}
  38. {{ behavior_item.value -}}
  39. </span>
  40. {%- endfor -%}
  41. </div>
  42. {% endif %}
  43. </div>
  44. {% endif %}
  45. {% endapply %}