commit b760c74f6b425e5c46e2a0f4cae2df6f3cc68d26 Author: Erik Stielstra Date: Sun Aug 31 17:41:56 2014 +0200 #6 diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 9d0b654..8c7a664 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1556,6 +1556,7 @@ function theme_indentation($variables) { * Properties used: #id, #attributes, #children. */ function template_preprocess_container(&$variables) { + $variables['has_parent'] = FALSE; $element = $variables['element']; // Ensure #attributes is set. $element += array('#attributes' => array()); @@ -1566,6 +1567,7 @@ function template_preprocess_container(&$variables) { if (!isset($element['#attributes']['id'])) { $element['#attributes']['id'] = $element['#id']; } + $variables['has_parent'] = TRUE; } $variables['children'] = $element['#children']; diff --git a/core/modules/system/templates/container.html.twig b/core/modules/system/templates/container.html.twig index 5502c87..9ec8497 100644 --- a/core/modules/system/templates/container.html.twig +++ b/core/modules/system/templates/container.html.twig @@ -9,10 +9,16 @@ * 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() * * @ingroup themeable */ #} -{{ children }} +{% if has_parent %} + {{ children }} +{% else %} + {{ children }} +{% endif %}