container.html.twig
Same filename in this branch
Same filename in other branches
- 8.9.x core/themes/stable/templates/form/container.html.twig
- 8.9.x core/themes/classy/templates/form/container.html.twig
- 8.9.x core/modules/system/templates/container.html.twig
- 10 core/themes/stable9/templates/form/container.html.twig
- 10 core/themes/starterkit_theme/templates/form/container.html.twig
- 10 core/modules/system/templates/container.html.twig
- 11.x core/themes/stable9/templates/form/container.html.twig
- 11.x core/themes/starterkit_theme/templates/form/container.html.twig
- 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\RenderElement 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/ stable/ templates/ form/ container.html.twig
View source
- {#
- /**
- * @file
- * 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\RenderElement 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 template_preprocess_container()
- */
- #}
- {%
- set classes = [
- has_parent ? 'js-form-wrapper',
- has_parent ? 'form-wrapper',
- ]
- %}
- <div{{ attributes.addClass(classes) }}>{{ children }}</div>
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.