Skip to content

Commit

Permalink
Merge pull request #1502 from openeuropa/EWPP-4750
Browse files Browse the repository at this point in the history
EWPP-4750: Add extra_attributes to patterns used to render node templates.
  • Loading branch information
upchuk authored Oct 14, 2024
2 parents f0b4064 + 20b5453 commit 2cb6ed9
Show file tree
Hide file tree
Showing 22 changed files with 116 additions and 28 deletions.
3 changes: 2 additions & 1 deletion templates/content/node--oe-call-proposals--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
3 changes: 2 additions & 1 deletion templates/content/node--oe-call-tenders--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
3 changes: 2 additions & 1 deletion templates/content/node--oe-consultation--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
3 changes: 2 additions & 1 deletion templates/content/node--oe-event--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
3 changes: 2 additions & 1 deletion templates/content/node--oe-news--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
{% endapply %}
3 changes: 2 additions & 1 deletion templates/content/node--oe-organisation--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'lists_variant': 'vertical',
'image': image_url ? { 'src': image_url },
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
3 changes: 2 additions & 1 deletion templates/content/node--oe-page--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'lists': additional_information|default([]),
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
4 changes: 2 additions & 2 deletions templates/content/node--oe-person--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
{% set additional_information = additional_information|merge([additional_information_items]) %}
{% endif %}


{% block content %}
{{ pattern('list_item', {
'variant': 'thumbnail_secondary',
Expand All @@ -57,6 +56,7 @@
'lists_variant': 'vertical',
'image': content.portrait_image ? { 'src': content.portrait_image|render },
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
3 changes: 2 additions & 1 deletion templates/content/node--oe-policy--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'lists': additional_information|default([]),
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
3 changes: 2 additions & 1 deletion templates/content/node--oe-project--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
'lists_variant': 'vertical',
'image': image_url ? { 'src': image_url },
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
3 changes: 2 additions & 1 deletion templates/content/node--oe-publication--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
'external_link': external_link,
'extra_attributes': extra_attributes|default([]),
}) }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,11 @@ featured_item:
type: "array"
label: "Contextual links"
description: "Render array of contextual links"
preview: ~
preview: ~
extra_attributes:
type: "array"
label: "Extra attributes"
description: "List of extra attributes"
preview:
- name: "extra-attr"
value: "extra value"
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@
'secondary_meta': _footer_items,
'picture': _picture,
'labels': badges,
'extra_attributes': extra_attributes|default([]),
} %}
7 changes: 7 additions & 0 deletions templates/patterns/file_teaser/file_teaser.ui_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,10 @@ file_teaser:
label: "Contextual links"
description: "Render array of contextual links"
preview: ~
extra_attributes:
type: "array"
label: "Extra attributes"
description: "List of extra attributes"
preview:
- name: "extra-attr"
value: "extra value"
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,5 @@
'variant': 'thumbnail',
'lists': _lists,
'label': _label,
'extra_attributes': extra_attributes|default([]),
} only %}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
'image_position': (loop.first or loop.index == 4) ? 'top' : '',
'divider': (loop.index == 2 or loop.index == 5) ? true : false,
'extra_classes': (loop.index == 2 or loop.index == 5) ? 'ecl-u-flex-grow-1 ecl-u-mb-m' : 'ecl-u-flex-grow-1',
'contextual_links': item.contextual_links
'contextual_links': item.contextual_links,
'extra_attributes': item.extra_attributes|default([]),
}, 'default') %}
{% set _items = _items|merge([_item]) %}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
'image_position': 'top',
'divider': true,
'extra_classes': 'ecl-u-flex-grow-1',
'contextual_links': highlighted_item.contextual_links
'contextual_links': highlighted_item.contextual_links,
'extra_attributes': highlighted_item.extra_attributes|default([]),
}, 'default') %}
{% endif %}

Expand All @@ -45,7 +46,8 @@
'image_position': loop.first ? 'top' : '',
'divider': true,
'extra_classes': loop.last ? 'ecl-u-flex-grow-1' : 'ecl-u-flex-grow-1 ecl-u-mb-m',
'contextual_links': item.contextual_links
'contextual_links': item.contextual_links,
'extra_attributes': item.extra_attributes|default([]),
}, 'default') %}
{% set _items = _items|merge([_item]) %}
{% endfor %}
Expand Down
7 changes: 7 additions & 0 deletions templates/patterns/list_item/list_item.ui_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,10 @@ list_item:
label: 'Extra classes string'
description: 'Extra classes string'
preview: ''
extra_attributes:
type: "array"
label: "Extra attributes"
description: "List of extra attributes"
preview:
- name: "extra-attr"
value: "extra value"
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@
title: _title|default([]),
description: detail|smart_trim(_length),
labels: badges,
extra_classes: extra_classes|default(''),
extra_attributes: extra_attributes|default([]),
} only %}
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@
labels: badges,
primary_meta: primary_meta|default([]),
secondary_meta: _secondary_meta|default([]),
extra_classes: extra_classes|default(''),
extra_attributes: extra_attributes|default([]),
} only %}
1 change: 1 addition & 0 deletions templates/patterns/list_item/pattern-list-item.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,5 @@
secondary_meta: _secondary_meta|default([]),
date: _date|default([]),
extra_classes: extra_classes|default(''),
extra_attributes: extra_attributes|default([]),
} only %}
Loading

0 comments on commit 2cb6ed9

Please sign in to comment.