You are here

field-collection-item.html.twig in Field collection 8.3

Same filename and directory in other branches
  1. 8 templates/field-collection-item.html.twig

Default theme implementation for field collection items.

Available variables:

  • content: An array of comment items. Use {{ content }} to print them all, or print a subset such as {{ content.field_example }}. Use {% hide(content.field_example) %} to temporarily suppress the printing of a given element.
  • title: The (sanitized) field collection item label.
  • url: Direct url of the current entity if specified.
  • page: Flag for the full page state.
  • attributes: HTML attributes for the surrounding element. Attributes include the 'class' information.
  • content_attributes: HTML attributes for the content element.

See also

template_preprocess()

template_preprocess_entity()

File

templates/field-collection-item.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for field collection items.
  5. *
  6. * Available variables:
  7. * - content: An array of comment items. Use {{ content }} to print them all,
  8. * or print a subset such as {{ content.field_example }}. Use
  9. * {% hide(content.field_example) %} to temporarily suppress the printing
  10. * of a given element.
  11. * - title: The (sanitized) field collection item label.
  12. * - url: Direct url of the current entity if specified.
  13. * - page: Flag for the full page state.
  14. * - attributes: HTML attributes for the surrounding element.
  15. * Attributes include the 'class' information.
  16. * - content_attributes: HTML attributes for the content element.
  17. *
  18. * @see template_preprocess()
  19. * @see template_preprocess_entity()
  20. *
  21. * @ingroup themeable
  22. */
  23. #}
  24. {%
  25. set classes = [
  26. 'field-collection-item',
  27. 'field-collection-item--name-' ~ field_collection_item.name|clean_class,
  28. 'field-collection-item--view-mode-' ~ field_collection_item.view_mode|clean_class,
  29. ]
  30. %}
  31. <div{{ attributes.addClass(classes) }}>
  32. <div class="content"{{ content_attributes }}>
  33. {{ content }}
  34. </div>
  35. </div>