function uc_file_tokens in Ubercart 8.4
Same name and namespace in other branches
- 7.3 uc_file/uc_file.tokens.inc \uc_file_tokens()
Implements hook_tokens().
File
- uc_file/
uc_file.tokens.inc, line 35 - Token hooks for the uc_file module.
Code
function uc_file_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
$replacements = [];
if ($type == 'uc_file' && !empty($data['uc_file'])) {
$files = $data['uc_file'];
if (isset($tokens['downloads'])) {
$replacements[$tokens['downloads']] = theme('uc_file_downloads_token', [
'file_downloads' => $files,
]);
}
}
return $replacements;
}