Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

D8CORE-2529: if there is a link but no content set the link to null #756

Merged
merged 3 commits into from
Sep 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core/src/templates/components/media/media.twig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
* - 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 -%}

<figure {{ attributes }} class="su-media {{ modifier_class }}">
{# Option to make the media element a clickable link #}
{%- if media_link %}
Expand Down