function template_preprocess_file_link

Same name and namespace in other branches
  1. 10 core/modules/file/file.module \template_preprocess_file_link()
  2. 9 core/modules/file/file.module \template_preprocess_file_link()
  3. 8.9.x core/modules/file/file.module \template_preprocess_file_link()

Prepares variables for file link templates.

Default template: file-link.html.twig.

Parameters

array $variables: An associative array containing:

  • file: A File entity to which the link will be created.
  • icon_directory: (optional) A path to a directory of icons to be used for files. Defaults to the value of the "icon.directory" variable.
  • description: A description to be displayed instead of the filename.
  • attributes: An associative array of attributes to be placed in the a tag.

Deprecated

in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme().

See also

https://www.drupal.org/node/3504125

File

core/modules/file/file.module, line 432

Code

function template_preprocess_file_link(&$variables) : void {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
  \Drupal::service(FileThemeHooks::class)->preprocessFileLink($variables);
}

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