Same filename in this branch
  1. 8.9.x core/modules/file/templates/file-link.html.twig
  2. 8.9.x core/themes/claro/templates/field/file-link.html.twig
  3. 8.9.x core/themes/classy/templates/field/file-link.html.twig
  4. 8.9.x core/themes/stable/templates/field/file-link.html.twig
  5. 8.9.x core/themes/bartik/templates/classy/field/file-link.html.twig
  6. 8.9.x core/themes/seven/templates/classy/field/file-link.html.twig
  7. 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/field/file-link.html.twig
Same filename and directory in other branches
  1. 10 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()

4 theme calls to file-link.html.twig
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/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. {# @todo remove class before Drupal 9.0.0 #}
  19. <span class="file-size">({{ file_size }})</span>
  20. {% endif %}

Related topics