Create Utility Templates

Created on 9 July 2023, 12 months ago
Updated 19 January 2024, 5 months ago

Problem/Motivation

Compile a list of utility templates we could utilize and implement them. One example of this would be a template that can generate grid items for you. See rough examples.

{% set grid_attributes = create_attribute(grid_attributes|default({})) %}
{% set grid_tag = grid_tag|default('div') %}
{% set cell_attributes = create_attribute(cell_attributes|default({})) %}
{% set cell_tag = cell_tag|default('div') %}
<{{ grid_tag }}{{ grid_attributes }}>
{% if summary %}
  {% for item in items['#items'] %}
    <{{ cell_tag }}{{ cell_attributes }}>
    {{ item }}
    </{{ cell_tag }}>
  {% endfor %}
{% else %}
  {% for i in items['#items']|keys %}
    <{{ cell_tag }}{{ cell_attributes }}>
      {{ items[i] }}
    </{{ cell_tag }}>
  {% endfor %}
{% endif %}
</{{ grid_tag }}>
{% set grid_attributes = create_attribute(grid_attributes|default({})) %}
{% set grid_tag = grid_tag|default('div') %}
{% set cell_attributes = create_attribute(cell_attributes|default({})) %}
{% set cell_tag = cell_tag|default('div') %}
<{{ grid_tag }}{{ grid_attributes }}>
{% if summary %}
  {% for item in items['#items'] %}
    <{{ cell_tag }}{{ cell_attributes }}>
    {{ item }}
    </{{ cell_tag }}>
  {% endfor %}
{% else %}
  {% for i in items['#items']|keys %}
    <{{ cell_tag }}{{ cell_attributes }}>
      {{ items[i] }}
    </{{ cell_tag }}>
  {% endfor %}
{% endif %}
</{{ grid_tag }}>
{{ attach_library('themekit/organism--key-facts') }}
<div class="organism--key-facts grid-container--narrow no-padding">
  {% include '@layout/grid/grid.twig' with {
    items: items,
    grid_attributes: {'class': ['grid-x', 'grid-margin-y', 'grid-margin-x', 'align-center']},
    cell_attributes: {'class': ['cell xsmall-12 medium-4']},
  } %}
</div>
πŸ“Œ Task
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States brayn7 Lexington, Ky

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024