public function FileEntity::downloadUrl in File Entity (fieldable files) 8.2
Returns a Url for a file download.
Parameters
array $options: (optional) Options for the URL object.
Return value
\Drupal\Core\Url An Url object for the download url.
File
- src/
Entity/ FileEntity.php, line 449
Class
- FileEntity
- Replace for the core file entity class.
Namespace
Drupal\file_entity\EntityCode
public function downloadUrl($options = array()) {
$url = new Url('file_entity.file_download', array(
'file' => $this
->id(),
), $options);
if (!\Drupal::config('file_entity.settings')
->get('allow_insecure_download')) {
$url
->setOption('query', array(
'token' => $this
->getDownloadToken(),
));
}
return $url;
}