diff --git a/templates/patterns/card/card.ui_patterns.yml b/templates/patterns/card/card.ui_patterns.yml index 102f39ca5..3e2668a61 100644 --- a/templates/patterns/card/card.ui_patterns.yml +++ b/templates/patterns/card/card.ui_patterns.yml @@ -13,6 +13,16 @@ card: type: string label: 'Orientation' description: 'Can be set to horizontal or vertical. Defaults to vertical.' + left_col_classes: + type: string + label: 'Left column classes' + description: 'When horizontal orientation. Classes of left column.' + preview: 'col-3' + right_col_classes: + type: string + label: 'Right column classes' + description: 'When horizontal orientation. Classes of right column.' + preview: 'col-9' title: type: text label: 'Title' @@ -55,6 +65,10 @@ card: label: 'Content' description: 'Card content.' preview: '' + extra_classes_body: + type: string + label: 'Extra classes body' + description: 'Can be set additional classes for card body/content.' header: type: text label: 'Card header' @@ -65,6 +79,10 @@ card: label: 'Card footer' description: 'Card footer content.' preview: 'Footer of card' + extra_classes_footer: + type: string + label: 'Extra classes footer' + description: 'Can be set additional classes for card footer.' badges: type: array label: 'Badges' diff --git a/templates/patterns/card/pattern-card.html.twig b/templates/patterns/card/pattern-card.html.twig index 0346ef4a6..32fd7052c 100644 --- a/templates/patterns/card/pattern-card.html.twig +++ b/templates/patterns/card/pattern-card.html.twig @@ -5,6 +5,12 @@ */ #} {% apply spaceless %} +{% set _image = image ? image|merge({ + 'path': image.src, + 'alt': image.alt, +}) %} +{% set _left_col_classes = left_col_classes|default('col-4') %} +{% set _right_col_classes = right_col_classes|default('col-8') %} {% set _content %} {% if meta is not empty %} {# Use negative margin to compensate for me-3 on each item. #} @@ -35,8 +41,8 @@ {% include '@oe-bcl/card' with { 'horizontal': orientation == 'horizontal', 'horizontal_grid': (orientation == 'horizontal') ? { - left_col_classes: 'col-4', - right_col_classes: 'col-8', + left_col_classes: _left_col_classes, + right_col_classes: _right_col_classes, gutter: 0, } : {}, 'title': title, @@ -51,6 +57,7 @@ 'tag': 'div', } : {}, 'content': _content, + 'extra_classes_body' : extra_classes_body, 'image': image ? { 'path': image.src, 'alt': image.alt, @@ -58,6 +65,7 @@ 'date': date|default({}), 'card_header': header, 'card_footer': footer, + 'extra_classes_footer' : extra_classes_footer, 'badges': _badges, 'attributes': attributes, } only %} diff --git a/templates/patterns/content_banner/pattern-content-banner.html.twig b/templates/patterns/content_banner/pattern-content-banner.html.twig index b83ca1fcf..417262ea5 100644 --- a/templates/patterns/content_banner/pattern-content-banner.html.twig +++ b/templates/patterns/content_banner/pattern-content-banner.html.twig @@ -6,6 +6,10 @@ #} {% apply spaceless %} {# Render the 'meta' items into the content variable. #} +{% set _image = image ? image|merge({ + 'path': image.src, + 'alt': image.alt, +}) %} {% set _content %} {% set content_attributes = create_attribute().addClass(['mt-4', 'card-content']) %} {% if meta is not empty %} @@ -37,10 +41,7 @@ 'title': title, 'title_tag': title_tag, 'content': _content, - 'image': image ? { - 'path': image.src, - 'alt': image.alt, - } : {}, + 'image': _image, 'image_size': image_size ?? 'lg', 'badges': _badges, 'links': links,