如何在drupal中更改文件url



我有一个文件字段。在页面上呈现为

<a href="http://somesite/somefolder/9.doc" type="application/msword; length=392192">9.doc</a>

我想让它像

那样锁定
<a href="http://othersite/otherfolder/9.doc" type="application/msword; length=392192">9.doc</a> 

1:(我已经尝试复制core/themes/bartik/templates/classy/field/file-link.html。分支到我的主题并重命名为文件名建议到FILE——link——user-checklist.html。树枝,但仍然有核心模板渲染

2: (我尝试通过checklistheme_preprocess_file_link更改url,但$variables['link']['#url']- setFileUri($my_url);但是有错误这个方法不存在

3: (我尝试添加自定义元素到checklist_preprocess_paragraph(&$variables),但它没有显示

我不知道我还能做什么

找回自我

function MYTHEME_preprocess_file_link(&$variables) {
$file = DrupalCoreUrl::fromUri('some_url');
$variables['link']['#url'] = $file;

}