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/profiles/demo_umami/themes/umami/templates/components/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.
  • 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/themes/stable9/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. * - file_size: The size of the file.
  10. *
  11. * @see template_preprocess_file_link()
  12. */
  13. #}
  14. <span{{ attributes }}>{{ link }}</span>
  15. {% if file_size %}
  16. <span>({{ file_size }})</span>
  17. {% endif %}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal