You are here

function theme_uc_file_downloads_token in Ubercart 8.4

Same name and namespace in other branches
  1. 5 uc_file/uc_file.module \theme_uc_file_downloads_token()
  2. 6.2 uc_file/uc_file.module \theme_uc_file_downloads_token()
  3. 7.3 uc_file/uc_file.tokens.inc \theme_uc_file_downloads_token()

Themes the file download links token.

1 string reference to 'theme_uc_file_downloads_token'
uc_file_theme in uc_file/uc_file.module
Implements hook_theme().
1 theme call to theme_uc_file_downloads_token()
uc_file_tokens in uc_file/uc_file.tokens.inc
Implements hook_tokens().

File

uc_file/uc_file.tokens.inc, line 54
Token hooks for the uc_file module.

Code

function theme_uc_file_downloads_token(array $variables) {
  $file_downloads = $variables['file_downloads'];
  $output = '';
  foreach ($file_downloads as $file_download) {

    // Let's only notify of them of the files, not the directories.
    if (is_dir($file_download->filename)) {
      continue;
    }
    $output .= Link::createFromRoute($file_download->filename, 'uc_file.download_file', [
      'file' => $file_download->fid,
    ], [
      'absolute' => TRUE,
    ])
      ->toString() . "\n";
  }
  return $output;
}