field--paragraphs.html.twig

This is not really a theme override but a base template for other paragraph fields which want to extend this.

We assume that most of the paragraph fields most of the time have single values (they are not multi fields). This is why in our default templates we render just first item.

Available variables:

  • attributes: HTML attributes for the containing element.
  • label_hidden: Whether to show the field label or not.
  • title_attributes: HTML attributes for the title.
  • label: The label for the field.
  • multiple: TRUE if a field can contain multiple items.
  • items: List of all the field items. Each item contains:
    • attributes: List of HTML attributes for each item.
    • content: The field item's content.
  • entity_type: The entity type to which the field belongs.
  • field_name: The name of the field.
  • field_type: The type of the field.
  • label_display: The display settings for the label.

See also

template_preprocess_field()

File

paragraphs_collection/templates/field--paragraphs.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * This is not really a theme override but a base template for other paragraph
  5. * fields which want to extend this.
  6. *
  7. * We assume that most of the paragraph fields most of the time have single
  8. * values (they are not multi fields). This is why in our default templates
  9. * we render just first item.
  10. *
  11. * Available variables:
  12. * - attributes: HTML attributes for the containing element.
  13. * - label_hidden: Whether to show the field label or not.
  14. * - title_attributes: HTML attributes for the title.
  15. * - label: The label for the field.
  16. * - multiple: TRUE if a field can contain multiple items.
  17. * - items: List of all the field items. Each item contains:
  18. * - attributes: List of HTML attributes for each item.
  19. * - content: The field item's content.
  20. * - entity_type: The entity type to which the field belongs.
  21. * - field_name: The name of the field.
  22. * - field_type: The type of the field.
  23. * - label_display: The display settings for the label.
  24. *
  25. *
  26. * @see template_preprocess_field()
  27. */
  28. #}
  29. {% block content %}
  30. <div{{ attributes }}>{{ items[0].content }}</div>
  31. {% endblock %}