From 6367d5eb2bfaa802520d30775d28557a38e099c9 Mon Sep 17 00:00:00 2001 From: James O'Toole Date: Tue, 18 Jun 2024 16:15:25 -0700 Subject: [PATCH] Clean up target values --- templates/content/node--card-horizontal.html.twig | 4 ++-- templates/content/node--card-image.html.twig | 4 ++-- templates/content/node--card-vertical.html.twig | 4 ++-- templates/content/node--featured-content.html.twig | 2 +- .../node--ubc-event--card-horizontal.html.twig | 11 ++++++++--- .../content/node--ubc-event--card-image.html.twig | 11 ++++++++--- .../content/node--ubc-event--card-vertical.html.twig | 11 ++++++++--- ...bc-partner-organization--card-horizontal.html.twig | 4 ++-- ...-ubc-partner-organization--card-vertical.html.twig | 4 ++-- ...ubc-profile--card-horizontal-round-image.html.twig | 2 +- .../node--ubc-profile--card-horizontal.html.twig | 2 +- .../node--ubc-profile--card-vertical.html.twig | 2 +- .../paragraphs/paragraph--card-horizontal.html.twig | 3 +-- .../paragraphs/paragraph--card-rollover.html.twig | 3 +-- templates/paragraphs/paragraph--card-text.html.twig | 3 +-- .../paragraphs/paragraph--card-vertical.html.twig | 1 - templates/paragraphs/paragraph--icon-card.html.twig | 3 ++- templates/paragraphs/paragraph--image-card.html.twig | 4 ++-- 18 files changed, 45 insertions(+), 33 deletions(-) diff --git a/templates/content/node--card-horizontal.html.twig b/templates/content/node--card-horizontal.html.twig index 8b2b28c..77b5e4a 100644 --- a/templates/content/node--card-horizontal.html.twig +++ b/templates/content/node--card-horizontal.html.twig @@ -79,13 +79,13 @@ {% set displaymeta = node.createdtime|format_date('date_readable') %} {% endif %} -{% set link_target = '' %} +{% set link_target = false %} {% set link_url = url %} {% if not (node.field_announcement_external_link.isEmpty == true) and content.field_announcement_external_link is defined %} {% set exturl = content.field_announcement_external_link[0]['#url']|raw %} {% set exttitle = content.field_announcement_external_link[0]['#title']|raw %} {% set link_url = exturl %} - {% set link_target = '_blank' %} + {% set link_target = true %} {% endif %} {% embed 'kraken:card--primary' with { diff --git a/templates/content/node--card-image.html.twig b/templates/content/node--card-image.html.twig index 9022ba0..e3ca5c4 100644 --- a/templates/content/node--card-image.html.twig +++ b/templates/content/node--card-image.html.twig @@ -79,13 +79,13 @@ {% set displaymeta = node.createdtime|format_date('date_readable') %} {% endif %} -{% set link_target = '' %} +{% set link_target = false %} {% set link_url = url %} {% if not (node.field_announcement_external_link.isEmpty == true) and content.field_announcement_external_link is defined %} {% set exturl = content.field_announcement_external_link[0]['#url']|raw %} {% set exttitle = content.field_announcement_external_link[0]['#title']|raw %} {% set link_url = exturl %} - {% set link_target = '_blank' %} + {% set link_target = true %} {% endif %} {% embed 'kraken:card--image' with { diff --git a/templates/content/node--card-vertical.html.twig b/templates/content/node--card-vertical.html.twig index 5f33d76..48f4fa6 100755 --- a/templates/content/node--card-vertical.html.twig +++ b/templates/content/node--card-vertical.html.twig @@ -79,13 +79,13 @@ {% set displaymeta = node.createdtime|format_date('date_readable') %} {% endif %} -{% set link_target = '' %} +{% set link_target = false %} {% set link_url = url %} {% if not (node.field_announcement_external_link.isEmpty == true) and content.field_announcement_external_link is defined %} {% set exturl = content.field_announcement_external_link[0]['#url']|raw %} {% set exttitle = content.field_announcement_external_link[0]['#title']|raw %} {% set link_url = exturl %} - {% set link_target = '_blank' %} + {% set link_target = true %} {% endif %} {% embed 'kraken:card--primary' with { diff --git a/templates/content/node--featured-content.html.twig b/templates/content/node--featured-content.html.twig index 9922c41..6542389 100644 --- a/templates/content/node--featured-content.html.twig +++ b/templates/content/node--featured-content.html.twig @@ -87,7 +87,7 @@ {% endif %} {% set hasgradient = null %} {% if node.field_show_gradient_on_image.value %} - {% set hasgradient = 'true' %} + {% set hasgradient = true %} {% endif %} {% embed 'kraken:masthead' with { diff --git a/templates/content/node--ubc-event--card-horizontal.html.twig b/templates/content/node--ubc-event--card-horizontal.html.twig index 0509aa6..bfbf617 100755 --- a/templates/content/node--ubc-event--card-horizontal.html.twig +++ b/templates/content/node--ubc-event--card-horizontal.html.twig @@ -91,13 +91,18 @@ {% endif %} {% endif %} -{% set link_target = '' %} +{% set link_target = false %} {% set link_url = url %} -{% if not (node.field_event_link.isEmpty == true) and content.field_event_link is defined %} +{% if not (node.field_event_external_link.isEmpty == true) and content.field_event_external_link is defined %} + {% set exturl = content.field_event_external_link[0]['#url']|raw %} + {% set exttitle = content.field_event_external_link[0]['#title']|raw %} + {% set link_url = exturl %} + {% set link_target = true %} +{% elseif not (node.field_event_link.isEmpty == true) and content.field_event_link is defined %} {% set exturl = content.field_event_link[0]['#url']|raw %} {% set exttitle = content.field_event_link[0]['#title']|raw %} {% set link_url = exturl %} - {% set link_target = '_blank' %} + {% set link_target = true %} {% endif %} {% embed 'kraken:card--primary' with { diff --git a/templates/content/node--ubc-event--card-image.html.twig b/templates/content/node--ubc-event--card-image.html.twig index 5aa88fe..86c3770 100644 --- a/templates/content/node--ubc-event--card-image.html.twig +++ b/templates/content/node--ubc-event--card-image.html.twig @@ -92,13 +92,18 @@ {% endif %} {% endif %} +{% set link_target = false %} {% set link_url = url %} -{% set link_target = '_self' %} -{% if not (node.field_event_link.isEmpty == true) and content.field_event_link is defined %} +{% if not (node.field_event_external_link.isEmpty == true) and content.field_event_external_link is defined %} + {% set exturl = content.field_event_external_link[0]['#url']|raw %} + {% set exttitle = content.field_event_external_link[0]['#title']|raw %} + {% set link_url = exturl %} + {% set link_target = true %} +{% elseif not (node.field_event_link.isEmpty == true) and content.field_event_link is defined %} {% set exturl = content.field_event_link[0]['#url']|raw %} {% set exttitle = content.field_event_link[0]['#title']|raw %} {% set link_url = exturl %} - {% set link_target = '_blank' %} + {% set link_target = true %} {% endif %} {% embed 'kraken:card--image' with { diff --git a/templates/content/node--ubc-event--card-vertical.html.twig b/templates/content/node--ubc-event--card-vertical.html.twig index 88aed2c..d1c5b35 100644 --- a/templates/content/node--ubc-event--card-vertical.html.twig +++ b/templates/content/node--ubc-event--card-vertical.html.twig @@ -92,13 +92,18 @@ {% endif %} {% endif %} +{% set link_target = false %} {% set link_url = url %} -{% set link_target = '_self' %} -{% if not (node.field_event_link.isEmpty == true) and content.field_event_link is defined %} +{% if not (node.field_event_external_link.isEmpty == true) and content.field_event_external_link is defined %} + {% set exturl = content.field_event_external_link[0]['#url']|raw %} + {% set exttitle = content.field_event_external_link[0]['#title']|raw %} + {% set link_url = exturl %} + {% set link_target = true %} +{% elseif not (node.field_event_link.isEmpty == true) and content.field_event_link is defined %} {% set exturl = content.field_event_link[0]['#url']|raw %} {% set exttitle = content.field_event_link[0]['#title']|raw %} {% set link_url = exturl %} - {% set link_target = '_blank' %} + {% set link_target = true %} {% endif %} {% embed 'kraken:card--primary' with { diff --git a/templates/content/node--ubc-partner-organization--card-horizontal.html.twig b/templates/content/node--ubc-partner-organization--card-horizontal.html.twig index cd26819..b64bfbb 100644 --- a/templates/content/node--ubc-partner-organization--card-horizontal.html.twig +++ b/templates/content/node--ubc-partner-organization--card-horizontal.html.twig @@ -74,13 +74,13 @@ {% endif %} {% endif %} -{% set link_target = '' %} +{% set link_target = false %} {% set link_url = url %} {% if not (node.field_partner_link.isEmpty == true) and content.field_partner_link is defined %} {% set exturl = content.field_partner_link[0]['#url']|raw %} {% set exttitle = content.field_partner_link[0]['#title']|raw %} {% set link_url = exturl %} - {% set link_target = '_blank' %} + {% set link_target = true %} {% endif %} {% embed 'kraken:card--primary' with { diff --git a/templates/content/node--ubc-partner-organization--card-vertical.html.twig b/templates/content/node--ubc-partner-organization--card-vertical.html.twig index 3f46630..2d787a2 100644 --- a/templates/content/node--ubc-partner-organization--card-vertical.html.twig +++ b/templates/content/node--ubc-partner-organization--card-vertical.html.twig @@ -75,13 +75,13 @@ {% endif %} {% endif %} -{% set link_target = '' %} +{% set link_target = false %} {% set link_url = url %} {% if not (node.field_partner_link.isEmpty == true) and content.field_partner_link is defined %} {% set exturl = content.field_partner_link[0]['#url']|raw %} {% set exttitle = content.field_partner_link[0]['#title']|raw %} {% set link_url = exturl %} - {% set link_target = '_blank' %} + {% set link_target = true %} {% endif %} {% embed 'kraken:card--primary' with { diff --git a/templates/content/node--ubc-profile--card-horizontal-round-image.html.twig b/templates/content/node--ubc-profile--card-horizontal-round-image.html.twig index d1ea5d0..4e16c3a 100644 --- a/templates/content/node--ubc-profile--card-horizontal-round-image.html.twig +++ b/templates/content/node--ubc-profile--card-horizontal-round-image.html.twig @@ -75,7 +75,7 @@ {% endif %} {% endif %} -{% set link_target = '' %} +{% set link_target = false %} {% set link_url = url %} {% embed 'kraken:card--primary' with { diff --git a/templates/content/node--ubc-profile--card-horizontal.html.twig b/templates/content/node--ubc-profile--card-horizontal.html.twig index 85ca551..6f45dde 100644 --- a/templates/content/node--ubc-profile--card-horizontal.html.twig +++ b/templates/content/node--ubc-profile--card-horizontal.html.twig @@ -74,7 +74,7 @@ {% endif %} {% endif %} -{% set link_target = '' %} +{% set link_target = false %} {% set link_url = url %} {% embed 'kraken:card--primary' with { diff --git a/templates/content/node--ubc-profile--card-vertical.html.twig b/templates/content/node--ubc-profile--card-vertical.html.twig index 409fba3..8b4e37f 100644 --- a/templates/content/node--ubc-profile--card-vertical.html.twig +++ b/templates/content/node--ubc-profile--card-vertical.html.twig @@ -75,7 +75,7 @@ {% endif %} {% endif %} -{% set link_target = '' %} +{% set link_target = false %} {% set link_url = url %} {% embed 'kraken:card--primary' with { diff --git a/templates/paragraphs/paragraph--card-horizontal.html.twig b/templates/paragraphs/paragraph--card-horizontal.html.twig index 31b340c..38fe091 100644 --- a/templates/paragraphs/paragraph--card-horizontal.html.twig +++ b/templates/paragraphs/paragraph--card-horizontal.html.twig @@ -38,13 +38,12 @@ * @ingroup themeable */ #} - +{% set target = false %} {% if content.field_paragraph_card_link["#items"][0].isExternal() == true %} {% set link_url = content.field_paragraph_card_link.0['#url'].uri %} {% set target = true %} {% else %} {% set link_url = paragraph.field_paragraph_card_link.0.url %} - {% set target = false %} {% endif %} {% if content.field_show_image_on_right.0['#markup'] == 'On' %} diff --git a/templates/paragraphs/paragraph--card-rollover.html.twig b/templates/paragraphs/paragraph--card-rollover.html.twig index a36f9a5..13ebe33 100644 --- a/templates/paragraphs/paragraph--card-rollover.html.twig +++ b/templates/paragraphs/paragraph--card-rollover.html.twig @@ -38,13 +38,12 @@ * @ingroup themeable */ #} - +{% set target = false %} {% if content.field_paragraph_card_link["#items"][0].isExternal() == true %} {% set link_url = content.field_paragraph_card_link.0['#url'].uri %} {% set target = true %} {% else %} {% set link_url = paragraph.field_paragraph_card_link.0.url %} - {% set target = false %} {% endif %} {% block paragraph %} diff --git a/templates/paragraphs/paragraph--card-text.html.twig b/templates/paragraphs/paragraph--card-text.html.twig index a1348f5..73dfc24 100644 --- a/templates/paragraphs/paragraph--card-text.html.twig +++ b/templates/paragraphs/paragraph--card-text.html.twig @@ -38,13 +38,12 @@ * @ingroup themeable */ #} - +{% set target = false %} {% if content.field_paragraph_card_link["#items"][0].isExternal() == true %} {% set link_url = content.field_paragraph_card_link.0['#url'].uri %} {% set target = true %} {% else %} {% set link_url = paragraph.field_paragraph_card_link.0.url %} - {% set target = false %} {% endif %} {% block paragraph %} diff --git a/templates/paragraphs/paragraph--card-vertical.html.twig b/templates/paragraphs/paragraph--card-vertical.html.twig index e6c34ed..bbbf740 100644 --- a/templates/paragraphs/paragraph--card-vertical.html.twig +++ b/templates/paragraphs/paragraph--card-vertical.html.twig @@ -44,7 +44,6 @@ {% set target = true %} {% else %} {% set link_url = paragraph.field_paragraph_card_link.0.url %} - {% endif %} {% block paragraph %} diff --git a/templates/paragraphs/paragraph--icon-card.html.twig b/templates/paragraphs/paragraph--icon-card.html.twig index 7876ec9..71c9539 100644 --- a/templates/paragraphs/paragraph--icon-card.html.twig +++ b/templates/paragraphs/paragraph--icon-card.html.twig @@ -38,18 +38,19 @@ * @ingroup themeable */ #} +{% set target = false %} {% if content.field_paragraph_icon_card_link["#items"][0].isExternal() == true %} {% set link_url = content.field_paragraph_icon_card_link.0['#url'].uri %} {% set target = true %} {% else %} {% set link_url = paragraph.field_paragraph_icon_card_link.0.url %} - {% set target = false %} {% endif %} {% block paragraph %} {% embed 'kraken:card--icon' with { title: paragraph.field_paragraph_icon_card_title.value, link: link_url, + target: target, linkText: content.field_paragraph_icon_card_link.0['#title'], layout: paragraph.field_paragraph_icon_layout.0.entity.field_class.value, color: paragraph.field_paragraph_card_colour.0.entity.field_class.value, diff --git a/templates/paragraphs/paragraph--image-card.html.twig b/templates/paragraphs/paragraph--image-card.html.twig index 6b98535..6e12126 100644 --- a/templates/paragraphs/paragraph--image-card.html.twig +++ b/templates/paragraphs/paragraph--image-card.html.twig @@ -39,18 +39,18 @@ */ #} {% set link_text = content.field_paragraph_card_link[0]['#title']|raw %} - +{% set target = false %} {% if content.field_paragraph_card_link["#items"][0].isExternal() == true %} {% set link_url = content.field_paragraph_card_link.0['#url'].uri %} {% set target = true %} {% else %} {% set link_url = paragraph.field_paragraph_card_link.0.url %} - {% set target = false %} {% endif %} {% embed 'kraken:card--image' with { title: paragraph.field_paragraph_card_title.value, link: link_url, + target: target, linkText: link_text, layout: paragraph.field_paragraph_position_setting.0.entity.field_class.value, } %}