There is no bloody way to get a node URL from a DS template

... not without the internet, at least.  Why the hell can't you build associative arrays in Twig?
Should have just done a preprocess function, but seriously, what in the hell?
This commit is contained in:
benjamin melançon 2019-10-01 13:12:21 -04:00
parent 3fa06f9ea8
commit 3777ffe098

View file

@ -13,11 +13,16 @@
{{ title_suffix.contextual_links }}
{% set route_options = [] %}
{% set route_options['node'] = node %}
{% set link_path = path('entity.node.canonical', route_options) %}
{{ url }}
{{ node.id }}
{% set image = ds_content.field_image|render %}
{% if image %}
{{ image }}
{% else %}
<figure class="background-replacement-for-no-image image"></figure>
<a href="/test" class="background-replacement-for-no-image image"></a>
{% endif %}
{{ ds_content|without('field_image') }}