download_file.module in DownloadFile 8
Same filename and directory in other branches
File
download_file.moduleView source
<?php
use Drupal\Core\Link;
use Drupal\Core\Url;
function download_file_theme() {
return [
'direct_download_file_link' => [
'variables' => [
'url' => NULL,
'link_text' => NULL,
'attributes' => [],
'file_id' => NULL,
],
],
];
}
function template_preprocess_direct_download_file_link(&$vars) {
$url = URL::fromRoute('download_file.download_file_path', [
'file_id' => $vars['file_id'],
]);
$vars['link'] = Link::fromTextAndUrl($vars['link_text'], $url);
}