Make link URL work

This commit is contained in:
benjamin melançon 2018-11-21 11:42:53 -05:00
parent 6dc408619b
commit 1b5d880a40

View file

@ -1,8 +1,17 @@
{# Damn you to hell, Drupal, this should not be anywhere near this complicated #}
{# Credit to leymannx, https://drupal.stackexchange.com/a/247807/4195 #}
{% if paragraph.field_link.0.url.external %}
{% set url = paragraph.field_link.uri %}
{% elseif paragraph.field_link.0.url.routeName %}
{% set url = path(paragraph.field_link.0.url.routeName, paragraph.field_link.0.url.routeParameters) %}
{% else %}
{% set url = "" %}
{% endif %}
{# Include slide component template. #} {# Include slide component template. #}
{% {%
include '@agaric/components/slide.html.twig' with { include '@agaric/components/slide.html.twig' with {
image: content.field_image, image: content.field_image,
text: content.field_text, text: content.field_text,
url: content.field_link, url: url,
} only } only
%} %}