Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

file-link.html.twig

Same filename in this branch
  1. 11.1.x core/themes/stable9/templates/field/file-link.html.twig
  2. 11.1.x core/themes/starterkit_theme/templates/field/file-link.html.twig
  3. 11.1.x core/themes/claro/templates/field/file-link.html.twig
  4. 11.1.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.
  • file_size: The size of the file.

See also

template_preprocess_file_link()

3 theme calls to file-link.html.twig
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/profiles/demo_umami/themes/umami/templates/components/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.
  10. * - file_size: The size of the file.
  11. *
  12. * @see template_preprocess_file_link()
  13. */
  14. #}
  15. {{ attach_library('umami/classy.file') }}
  16. <span{{ attributes }}>{{ icon }} {{ link }}</span>
RSS feed
Powered by Drupal