From 5bd8ab8b80f4ec4172198e8683a847baa3a3feb9 Mon Sep 17 00:00:00 2001 From: Jen Breese-Kauth Date: Mon, 21 Sep 2020 16:00:27 -0700 Subject: [PATCH 1/3] D8CORE-2529: if there is a link but no content set the link to null and not display it. --- core/src/templates/components/media/media.twig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/templates/components/media/media.twig b/core/src/templates/components/media/media.twig index c65b4ad8b..162693e1d 100644 --- a/core/src/templates/components/media/media.twig +++ b/core/src/templates/components/media/media.twig @@ -28,9 +28,13 @@ * - media_caption: Optional caption for the media. */ #} +
{# Option to make the media element a clickable link #} - {%- if media_link %} + {# Set link to null if there is no content to prevent an empty link #} + {% if media_link is not empty and media_image_src is empty and media_audio_src is empty and media_video_src is empty %} + {% set media_link = null %} + {%- elseif media_link %} {% endif -%} From 655003743cf6fcec91abf01373aaa77e40197381 Mon Sep 17 00:00:00 2001 From: Jen Breese-Kauth Date: Mon, 21 Sep 2020 16:30:56 -0700 Subject: [PATCH 2/3] D8CORE-2529: fixup! --- core/src/templates/components/media/media.twig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/templates/components/media/media.twig b/core/src/templates/components/media/media.twig index 162693e1d..146f803f0 100644 --- a/core/src/templates/components/media/media.twig +++ b/core/src/templates/components/media/media.twig @@ -28,13 +28,14 @@ * - media_caption: Optional caption for the media. */ #} +{# Set link to null if there is no content to prevent an empty link #} + {% if media_link is not empty and media_image_src is empty and media_audio_src is empty and media_video_src is empty %} + {% set media_link = false %} + {% endif -%}
{# Option to make the media element a clickable link #} - {# Set link to null if there is no content to prevent an empty link #} - {% if media_link is not empty and media_image_src is empty and media_audio_src is empty and media_video_src is empty %} - {% set media_link = null %} - {%- elseif media_link %} + {%- if media_link %} {% endif -%} From 680408da021e8093eee81b0687c9866a35357351 Mon Sep 17 00:00:00 2001 From: Sherakama Date: Tue, 22 Sep 2020 09:19:12 -0700 Subject: [PATCH 3/3] Update media.twig --- core/src/templates/components/media/media.twig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/templates/components/media/media.twig b/core/src/templates/components/media/media.twig index 146f803f0..8849ce155 100644 --- a/core/src/templates/components/media/media.twig +++ b/core/src/templates/components/media/media.twig @@ -28,10 +28,11 @@ * - media_caption: Optional caption for the media. */ #} + {# Set link to null if there is no content to prevent an empty link #} - {% if media_link is not empty and media_image_src is empty and media_audio_src is empty and media_video_src is empty %} - {% set media_link = false %} - {% endif -%} +{%- if media_link is not empty and media_image_src is empty and media_audio_src is empty and media_video_src is empty -%} + {%- set media_link = false -%} +{%- endif -%}
{# Option to make the media element a clickable link #}