Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Adam Doe adamdoe

🏠
Working from home
View GitHub Profile
@leahtard
leahtard / node.twig.html
Last active Apr 1, 2022
Get file url in node for Drupal 8 twig template
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 #}