You are here

container.html.twig in Open Social 8.2

Theme override of a container used to wrap child elements.

Used for grouped form items. Can also be used as a theme wrapper for any renderable element, to surround it with a <div> and HTML attributes. See the Form API reference for more information on the #theme_wrappers render array property.

Available variables:

  • attributes: HTML attributes for the containing element.
  • children: The rendered child elements of the container.
  • has_parent: A flag to indicate that the container has one or more parent containers.

File

themes/socialbase/templates/system/container.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override of a container used to wrap child elements.
  5. *
  6. * Used for grouped form items. Can also be used as a theme wrapper for any
  7. * renderable element, to surround it with a <div> and HTML attributes.
  8. * See the @link forms_api_reference.html Form API reference @endlink for more
  9. * information on the #theme_wrappers render array property.
  10. *
  11. * Available variables:
  12. * - attributes: HTML attributes for the containing element.
  13. * - children: The rendered child elements of the container.
  14. * - has_parent: A flag to indicate that the container has one or more parent
  15. containers.
  16. *
  17. * @see template_preprocess_container()
  18. */
  19. #}
  20. {%
  21. set classes = [
  22. not attributes.hasClass('toolbar-menu-administration') ? 'form-group',
  23. has_parent ? 'js-form-wrapper form-wrapper',
  24. exposed_form ? 'views-exposed-form__actions',
  25. attributes.hasClass('field--name-field-comment-body') ? 'media-body',
  26. attributes.hasClass('field--name-message') ? 'media-body',
  27. attributes.hasClass('more-link') ? 'btn btn-flat',
  28. ]
  29. %}
  30. {% if bare %}
  31. {{ children }}
  32. {% else %}
  33. <div{{ attributes.addClass(classes) }}>
  34. {{ children }}
  35. </div>
  36. {% endif %}