From a0279d2e89899dd3a7b4704f28903d17f26ab129 Mon Sep 17 00:00:00 2001 From: David Celaya-Gonzalez <2702851+djcelaya@users.noreply.github.com> Date: Thu, 12 Mar 2026 15:20:31 -0700 Subject: [PATCH 1/6] Initial SDC conversion --- .../components/az-card/az-card.component.yml | 47 +++++++++++++ .../az_card/components/az-card/az-card.twig | 49 +++++++++++++ .../az_card/templates/az-card.html.twig | 69 +++++-------------- 3 files changed, 115 insertions(+), 50 deletions(-) create mode 100644 modules/custom/az_card/components/az-card/az-card.component.yml create mode 100644 modules/custom/az_card/components/az-card/az-card.twig diff --git a/modules/custom/az_card/components/az-card/az-card.component.yml b/modules/custom/az_card/components/az-card/az-card.component.yml new file mode 100644 index 0000000000..4f739e3336 --- /dev/null +++ b/modules/custom/az_card/components/az-card/az-card.component.yml @@ -0,0 +1,47 @@ +$schema: https://git.drupalcode.org/project/drupal/-/raw/11.x/core/assets/schemas/v1/metadata.schema.json +name: AZ Card +status: experimental +props: + type: object + properties: + media: + type: + - array + - 'null' + title: + type: + - string + - 'null' + body: + type: + - array + - 'null' + link: + type: + - array + - 'null' + link_url: + type: + - string + - object + - 'null' + title_style: + type: string + title_alignment: + type: string + title_level: + type: string + title_display: + type: string + has_media: + type: boolean + has_link: + type: boolean + has_body: + type: boolean + link_is_visually_hidden: + type: boolean + link_is_stretched: + type: boolean + link_label: + type: string diff --git a/modules/custom/az_card/components/az-card/az-card.twig b/modules/custom/az_card/components/az-card/az-card.twig new file mode 100644 index 0000000000..10e3a4f6a7 --- /dev/null +++ b/modules/custom/az_card/components/az-card/az-card.twig @@ -0,0 +1,49 @@ + + {% if has_media %} +
+ {{ media }} + {% if title and title_style == 'title-on-image' %} +
+ <{{ title_level }} class="fw-bold mt-auto card-title text-bg-gradient-black text-white mb-0 p-card pt-8 {{ title_alignment }} {{ title_display }}"> + {% if has_link %} + {{ title }} + {% else %} + {{ title }} + {% endif %} + +
+ {% endif %} +
+ {% endif %} + {% if title_style == 'title-on-image' and not has_body and (link_label == '' or link_is_visually_hidden) %} +
+ {% if has_link %} + {% if link_is_visually_hidden and link_is_stretched %} +
+ +
+ {% else %} +
{{ link }}
+ {% endif %} + {% endif %} +
+ {% else %} +
+ {% if title and title_style == 'default' %} + <{{ title_level }} class="fw-bold mt-0 mb-3 card-title {{ title_alignment }} {{ title_display }}"> + {% if has_link %} + {{ title }} + {% else %} + {{ title }} + {% endif %} + + {% endif %} + {% if has_body %} +
{{ body }}
+ {% endif %} + {% if has_link %} +
{{ link }}
+ {% endif %} +
+ {% endif %} + \ No newline at end of file diff --git a/modules/custom/az_card/templates/az-card.html.twig b/modules/custom/az_card/templates/az-card.html.twig index 20ed9a4c44..2af25dc97e 100644 --- a/modules/custom/az_card/templates/az-card.html.twig +++ b/modules/custom/az_card/templates/az-card.html.twig @@ -19,54 +19,23 @@ */ #} -{% set attributes = attributes.addClass('h-100') %} +{% set link_classes = link['#attributes']['class']|default([]) %} - - {% if media %} -
- {{ media }} - {% if title and title_style == 'title-on-image' %} -
- <{{ title_level }} class="fw-bold mt-auto card-title text-bg-gradient-black text-white mb-0 p-card pt-8 {{ title_alignment }} {{ title_display }}"> - {% if link|render %} - {{ title }} - {% else %} - {{ title }} - {% endif %} - -
- {% endif %} -
- {% endif %} - {% if title_style == 'title-on-image' and body['#text'] == '' and (link['#title'] == '' or 'visually-hidden' in link['#attributes']['class'] ) %} -
- {% if link|render %} - {% if 'visually-hidden' in link['#attributes']['class'] and 'stretched-link' in link['#attributes']['class'] %} -
- -
- {% else %} -
{{ link }}
- {% endif %} - {% endif %} -
- {% else %} -
- {% if title and title_style == 'default' %} - <{{ title_level }} class="fw-bold mt-0 mb-3 card-title {{ title_alignment }} {{ title_display }}"> - {% if link|render %} - {{ title }} - {% else %} - {{ title }} - {% endif %} - - {% endif %} - {% if body['#text'] %} -
{{ body }}
- {% endif %} - {% if link %} -
{{ link }}
- {% endif %} -
- {% endif %} - +{% include 'az_card:az-card' with { + attributes: attributes.addClass('h-100'), + media: media, + title: title, + body: body, + link: link, + link_url: link_url, + title_style: title_style, + title_alignment: title_alignment, + title_level: title_level, + title_display: title_display, + has_media: media is not empty, + has_link: link is not empty, + has_body: body['#text']|default('') != '', + link_is_visually_hidden: 'visually-hidden' in link_classes, + link_is_stretched: 'stretched-link' in link_classes, + link_label: link['#title']|default(''), +} only %} From 4be0a6524e3247f193914581c7d24b456943fb88 Mon Sep 17 00:00:00 2001 From: David Celaya-Gonzalez <2702851+djcelaya@users.noreply.github.com> Date: Thu, 12 Mar 2026 15:42:48 -0700 Subject: [PATCH 2/6] Move front-end CSS to SDC --- modules/custom/az_card/az_card.libraries.yml | 4 ++-- .../az_card/{css => components/az-card}/az-card-no-follow.css | 2 +- .../{css => components/az-card}/az-card-title-hover.css | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename modules/custom/az_card/{css => components/az-card}/az-card-no-follow.css (98%) rename modules/custom/az_card/{css => components/az-card}/az-card-title-hover.css (99%) diff --git a/modules/custom/az_card/az_card.libraries.yml b/modules/custom/az_card/az_card.libraries.yml index ab894c6f77..a9f89db025 100644 --- a/modules/custom/az_card/az_card.libraries.yml +++ b/modules/custom/az_card/az_card.libraries.yml @@ -5,7 +5,7 @@ az_card: az_card_no_follow: css: component: - css/az-card-no-follow.css: {} + components/az-card/az-card-no-follow.css: {} js: js/az-card-no-follow.js: {} dependencies: @@ -13,4 +13,4 @@ az_card_no_follow: az_card_title_hover: css: component: - css/az-card-title-hover.css: {} + components/az-card/az-card-title-hover.css: {} diff --git a/modules/custom/az_card/css/az-card-no-follow.css b/modules/custom/az_card/components/az-card/az-card-no-follow.css similarity index 98% rename from modules/custom/az_card/css/az-card-no-follow.css rename to modules/custom/az_card/components/az-card/az-card-no-follow.css index 3fd8f43193..8bf832d4d8 100644 --- a/modules/custom/az_card/css/az-card-no-follow.css +++ b/modules/custom/az_card/components/az-card/az-card-no-follow.css @@ -2,4 +2,4 @@ .az-card-no-follow, .az-card-no-follow.btn:not(:disabled):not(.disabled) { cursor: not-allowed; -} +} \ No newline at end of file diff --git a/modules/custom/az_card/css/az-card-title-hover.css b/modules/custom/az_card/components/az-card/az-card-title-hover.css similarity index 99% rename from modules/custom/az_card/css/az-card-title-hover.css rename to modules/custom/az_card/components/az-card/az-card-title-hover.css index c7ab534c92..e91d76e2d6 100644 --- a/modules/custom/az_card/css/az-card-title-hover.css +++ b/modules/custom/az_card/components/az-card/az-card-title-hover.css @@ -15,4 +15,4 @@ .card-body .visually-hidden { display: block; position: static !important; -} +} \ No newline at end of file From c48f3cadeedc8f8502598b533c525640b1211c16 Mon Sep 17 00:00:00 2001 From: David Celaya-Gonzalez <2702851+djcelaya@users.noreply.github.com> Date: Thu, 12 Mar 2026 15:46:46 -0700 Subject: [PATCH 3/6] Move front-end JS to SDC --- modules/custom/az_card/az_card.libraries.yml | 2 +- .../az_card/{js => components/az-card}/az-card-no-follow.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename modules/custom/az_card/{js => components/az-card}/az-card-no-follow.js (98%) diff --git a/modules/custom/az_card/az_card.libraries.yml b/modules/custom/az_card/az_card.libraries.yml index a9f89db025..f93c823f41 100644 --- a/modules/custom/az_card/az_card.libraries.yml +++ b/modules/custom/az_card/az_card.libraries.yml @@ -7,7 +7,7 @@ az_card_no_follow: component: components/az-card/az-card-no-follow.css: {} js: - js/az-card-no-follow.js: {} + components/az-card/az-card-no-follow.js: {} dependencies: - core/drupal.nodelist.foreach az_card_title_hover: diff --git a/modules/custom/az_card/js/az-card-no-follow.js b/modules/custom/az_card/components/az-card/az-card-no-follow.js similarity index 98% rename from modules/custom/az_card/js/az-card-no-follow.js rename to modules/custom/az_card/components/az-card/az-card-no-follow.js index c0e1b62cd9..9147d0e857 100644 --- a/modules/custom/az_card/js/az-card-no-follow.js +++ b/modules/custom/az_card/components/az-card/az-card-no-follow.js @@ -33,4 +33,4 @@ }); }, }; -})(this.Drupal); +})(this.Drupal); \ No newline at end of file From feee3b714bed4350799377485a176743ffeca25c Mon Sep 17 00:00:00 2001 From: David Celaya-Gonzalez <2702851+djcelaya@users.noreply.github.com> Date: Thu, 12 Mar 2026 15:49:34 -0700 Subject: [PATCH 4/6] ESLint fix --- modules/custom/az_card/components/az-card/az-card-no-follow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/custom/az_card/components/az-card/az-card-no-follow.js b/modules/custom/az_card/components/az-card/az-card-no-follow.js index 9147d0e857..c0e1b62cd9 100644 --- a/modules/custom/az_card/components/az-card/az-card-no-follow.js +++ b/modules/custom/az_card/components/az-card/az-card-no-follow.js @@ -33,4 +33,4 @@ }); }, }; -})(this.Drupal); \ No newline at end of file +})(this.Drupal); From c96f8d93b8ae3a45391ce0b20cd2951fd907d54e Mon Sep 17 00:00:00 2001 From: David Celaya-Gonzalez <2702851+djcelaya@users.noreply.github.com> Date: Thu, 12 Mar 2026 16:07:13 -0700 Subject: [PATCH 5/6] Convert AZ Cards to a SDC --- .../az-cards/az-cards.component.yml | 20 +++++++++++++++++++ .../components/az-cards/az-cards.twig | 7 +++++++ .../templates/paragraph--az-cards.html.twig | 17 ++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.component.yml create mode 100644 modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.twig create mode 100644 modules/custom/az_paragraphs/az_paragraphs_cards/templates/paragraph--az-cards.html.twig diff --git a/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.component.yml b/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.component.yml new file mode 100644 index 0000000000..28b840dc49 --- /dev/null +++ b/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.component.yml @@ -0,0 +1,20 @@ +$schema: https://git.drupalcode.org/project/drupal/-/raw/11.x/core/assets/schemas/v1/metadata.schema.json +name: AZ Cards +status: experimental +props: + type: object + properties: + title: + type: + - string + - 'null' + title_color_class: + type: + - string + - 'null' + show_title: + type: boolean + cards: + type: + - array + - 'null' \ No newline at end of file diff --git a/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.twig b/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.twig new file mode 100644 index 0000000000..607952161f --- /dev/null +++ b/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.twig @@ -0,0 +1,7 @@ + + {% if show_title and title %} + {{ title }} + {% endif %} + + {{ cards }} + \ No newline at end of file diff --git a/modules/custom/az_paragraphs/az_paragraphs_cards/templates/paragraph--az-cards.html.twig b/modules/custom/az_paragraphs/az_paragraphs_cards/templates/paragraph--az-cards.html.twig new file mode 100644 index 0000000000..9d7f94a5e4 --- /dev/null +++ b/modules/custom/az_paragraphs/az_paragraphs_cards/templates/paragraph--az-cards.html.twig @@ -0,0 +1,17 @@ +{# +/** + * @file + * Theme override for the az_cards paragraph bundle. + */ +#} +{{ attach_library('az_paragraphs/az_paragraphs.az_cards') }} + +{% set card_settings = paragraph.getAllBehaviorSettings()['az_cards_paragraph_behavior']|default({}) %} + +{% include 'az_paragraphs_cards:az-cards' with { + attributes: attributes.addClass('az-cards'), + title: paragraph.field_az_title.value|default(''), + title_color_class: card_settings['card_deck_title_color']|default(''), + show_title: view_mode != 'preview', + cards: content.field_az_cards, +} only %} \ No newline at end of file From ff1207d047ba84c48586b51ede4cbf27cc3cb4fa Mon Sep 17 00:00:00 2001 From: David Celaya-Gonzalez <2702851+djcelaya@users.noreply.github.com> Date: Thu, 12 Mar 2026 16:11:25 -0700 Subject: [PATCH 6/6] PHPCS fix --- .../components/az-cards/az-cards.component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.component.yml b/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.component.yml index 28b840dc49..a581caf184 100644 --- a/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.component.yml +++ b/modules/custom/az_paragraphs/az_paragraphs_cards/components/az-cards/az-cards.component.yml @@ -17,4 +17,4 @@ props: cards: type: - array - - 'null' \ No newline at end of file + - 'null'