Same filename in this branch
  1. 10 core/modules/file/templates/file-link.html.twig
  2. 10 core/themes/claro/templates/field/file-link.html.twig
  3. 10 core/themes/stable9/templates/field/file-link.html.twig
  4. 10 core/themes/starterkit_theme/templates/field/file-link.html.twig
  5. 10 core/profiles/demo_umami/themes/umami/templates/components/field/file-link.html.twig
Same filename and directory in other branches
  1. 8.9.x core/modules/file/templates/file-link.html.twig
  2. 9 core/modules/file/templates/file-link.html.twig

Default theme implementation for a link to a file.

Available variables:

  • attributes: The HTML attributes for the containing element.
  • link: A link to the file.
  • file_size: The size of the file.

See also

template_preprocess_file_link()

3 theme calls to file-link.html.twig
FileEntityFormatterTest::testFormatterFileLinkWithQueryString in core/modules/file/tests/src/Kernel/Formatter/FileEntityFormatterTest.php
Tests the file_link field formatter using a query string.
FileFieldDisplayTest::testNodeDisplay in core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
Tests normal formatter display on node display.
ManagedFile::processManagedFile in core/modules/file/src/Element/ManagedFile.php
Render API callback: Expands the managed_file element type.

File

core/modules/file/templates/file-link.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a link to a file.
  5. *
  6. * Available variables:
  7. * - attributes: The HTML attributes for the containing element.
  8. * - link: A link to the file.
  9. * - file_size: The size of the file.
  10. *
  11. * @see template_preprocess_file_link()
  12. *
  13. * @ingroup themeable
  14. */
  15. #}
  16. <span{{ attributes }}>{{ link }}</span>
  17. {% if file_size %}
  18. <span>({{ file_size }})</span>
  19. {% endif %}

Related topics