container.html.twig

Same filename in this branch
  1. 10 core/themes/stable9/templates/form/container.html.twig
  2. 10 core/modules/system/templates/container.html.twig
Same filename in other branches
  1. 9 core/themes/stable9/templates/form/container.html.twig
  2. 9 core/themes/stable/templates/form/container.html.twig
  3. 9 core/themes/starterkit_theme/templates/form/container.html.twig
  4. 9 core/themes/classy/templates/form/container.html.twig
  5. 9 core/modules/system/templates/container.html.twig
  6. 8.9.x core/themes/stable/templates/form/container.html.twig
  7. 8.9.x core/themes/classy/templates/form/container.html.twig
  8. 8.9.x core/modules/system/templates/container.html.twig
  9. 11.x core/themes/stable9/templates/form/container.html.twig
  10. 11.x core/themes/starterkit_theme/templates/form/container.html.twig
  11. 11.x core/modules/system/templates/container.html.twig

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 \Drupal\Core\Render\Element\RenderElementBase for more information on the #theme_wrappers render array property, and \Drupal\Core\Render\Element\Container for usage of the container render element.

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.

See also

template_preprocess_container()

1 theme call to container.html.twig
forum_help in core/modules/forum/forum.module
Implements hook_help().

File

core/themes/starterkit_theme/templates/form/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 \Drupal\Core\Render\Element\RenderElementBase for more
  9. * information on the #theme_wrappers render array property, and
  10. * \Drupal\Core\Render\Element\Container for usage of the container render
  11. * element.
  12. *
  13. * Available variables:
  14. * - attributes: HTML attributes for the containing element.
  15. * - children: The rendered child elements of the container.
  16. * - has_parent: A flag to indicate that the container has one or more parent
  17. containers.
  18. *
  19. * @see template_preprocess_container()
  20. */
  21. #}
  22. {%
  23. set classes = [
  24. has_parent ? 'js-form-wrapper',
  25. has_parent ? 'form-wrapper',
  26. ]
  27. %}
  28. <div{{ attributes.addClass(classes) }}>{{ children }}</div>

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.