You are here

function template_preprocess_file_link_formatter_link_separate in File Link 8

Same name and namespace in other branches
  1. 2.0.x file_link.module \template_preprocess_file_link_formatter_link_separate()

Prepares variables for separated file_link field templates.

This template outputs a separate title and link.

Default template: file-link-formatter-link-separate.html.twig.

Parameters

array $variables: An associative array containing:

  • title: (optional) A descriptive or alternate title for the link, which may be different than the actual link text.
  • url_title: The anchor text for the link.
  • url: A \Drupal\Core\Url object.
  • size: The target file size formatted according to formatter settings.
  • format: The file mime-type.

File

./file_link.module, line 67
Contains file_link.module.

Code

function template_preprocess_file_link_formatter_link_separate(array &$variables) {
  $variables['link'] = Link::fromTextAndUrl($variables['url_title'], $variables['url']);
}