特定站点的drupal 8路径

drupal 8 path to a specific site

我在 drupal 8 站点上使用 dompdf。我需要为要放入其中的图像获取绝对值 URL。

在生成我的 pdf 的控制器方法中,我能够恢复路径:

$path = PublicStream::basePath();
// $path returns : sites/default/files 
$getpath = file_create_url($path); 
// $getpath returns : http://localhost/drupal/sites/default/files

事实上,我不使用默认文件夹,而是将所有内容都存储在特定站点中。 我如何检索 'sites/mysite/files' 而不是

不是很优雅但有效:

$host = \Drupal::request()->getSchemeAndHttpHost();
$host .= "/sites/mysite/files";