Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Knocking it out of the planet! 🌎

Steven Williams StevenGFX

🚀
Knocking it out of the planet! 🌎
View GitHub Profile
@StevenGFX
StevenGFX / node.twig.html
Last active Nov 27, 2018 — forked from leahtard/node.twig.html
Get file url in node for Drupal 8 twig template #drupal8 #twig
View node.twig.html
{# Get URL of single file field #}
{{ node.field_file.entity.uri.value }}
{# Get URL of multi file field #}
{{ node.field_file['#items'].entity.uri.value }}
{# Trun into link #}
{{ file_url(node.field_file.entity.uri.value) }}
{# Check if there is at least one value #}