file-link.html.twig

Same filename in this branch
  1. 10 core/profiles/demo_umami/themes/umami/templates/components/field/file-link.html.twig
  2. 10 core/themes/stable9/templates/field/file-link.html.twig
  3. 10 core/themes/starterkit_theme/templates/field/file-link.html.twig
  4. 10 core/modules/file/templates/file-link.html.twig
Same filename in other branches
  1. 9 core/profiles/demo_umami/themes/umami/templates/components/field/file-link.html.twig
  2. 9 core/themes/stable9/templates/field/file-link.html.twig
  3. 9 core/themes/seven/templates/field/file-link.html.twig
  4. 9 core/themes/claro/templates/field/file-link.html.twig
  5. 9 core/themes/bartik/templates/field/file-link.html.twig
  6. 9 core/themes/stable/templates/field/file-link.html.twig
  7. 9 core/themes/starterkit_theme/templates/field/file-link.html.twig
  8. 9 core/themes/classy/templates/field/file-link.html.twig
  9. 9 core/modules/file/templates/file-link.html.twig
  10. 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/field/file-link.html.twig
  11. 8.9.x core/themes/seven/templates/classy/field/file-link.html.twig
  12. 8.9.x core/themes/claro/templates/field/file-link.html.twig
  13. 8.9.x core/themes/bartik/templates/classy/field/file-link.html.twig
  14. 8.9.x core/themes/stable/templates/field/file-link.html.twig
  15. 8.9.x core/themes/classy/templates/field/file-link.html.twig
  16. 8.9.x core/modules/file/templates/file-link.html.twig
  17. 11.x core/profiles/demo_umami/themes/umami/templates/components/field/file-link.html.twig
  18. 11.x core/themes/stable9/templates/field/file-link.html.twig
  19. 11.x core/themes/claro/templates/field/file-link.html.twig
  20. 11.x core/themes/starterkit_theme/templates/field/file-link.html.twig
  21. 11.x core/modules/file/templates/file-link.html.twig

Theme override for a link to a file.

Available variables:

  • attributes: The HTML attributes for the containing element.
  • link: A link to the file.
  • icon: The icon image representing the file type. This seems to be always empty.
  • file_size: The size of the file.

See also

template_preprocess_file_link()

5 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.
GenericFileFormatter::viewElements in core/modules/file/src/Plugin/Field/FieldFormatter/GenericFileFormatter.php
Builds a renderable array for a field value.
ManagedFile::processManagedFile in core/modules/file/src/Element/ManagedFile.php
Render API callback: Expands the managed_file element type.
TableFormatter::viewElements in core/modules/file/src/Plugin/Field/FieldFormatter/TableFormatter.php
Builds a renderable array for a field value.

File

core/themes/claro/templates/field/file-link.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override 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. * - icon: The icon image representing the file type. This seems to be always
  10. * empty.
  11. * - file_size: The size of the file.
  12. *
  13. * @see template_preprocess_file_link()
  14. */
  15. #}
  16. {{ attach_library('claro/classy.file') }}
  17. <span{{ attributes }}>{{ link }} <span class="file__size">({{ file_size }})</span></span>

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.