From b5e38852756077ca01d4dcc0191b13d3da3afcd6 Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Wed, 5 Oct 2022 09:50:28 -0400 Subject: [PATCH] ISTWCMS-5789: adding template for container --- templates/container/container.html.twig | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 templates/container/container.html.twig diff --git a/templates/container/container.html.twig b/templates/container/container.html.twig new file mode 100644 index 00000000..40d8d7c6 --- /dev/null +++ b/templates/container/container.html.twig @@ -0,0 +1,48 @@ +{# +/** + * @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', +] +%} + +{% if header_data %} + <div class="node--type-{{ node_type }}"> + {% include '@components/card/card--node/_card--node.twig' with { + 'node': header_data, + 'type': 'node', + 'featured_image': featured_image, + } %} + </div> +{% endif %} + +<div{{ attributes.addClass(classes) }}>{{ children }}</div> + +{% if footer_data %} + <div class="layout uw-contained-width"> + {% include '@components/card/card--node/_card--node.twig' with { + 'node': footer_data, + 'type': 'node', + } %} + </div> +{% endif %} -- GitLab