Skip to content
Snippets Groups Projects

Resolve #3497796 "File download"

Open Michael Strelan requested to merge issue/drupal-3497796:3497796-file-download into 11.x
2 unresolved threads
Files
8
@@ -23,7 +23,7 @@
* @param string $uri
* The URI of the file.
*
* @return string[]|int
* @return string[]|int|null
* If the user does not have permission to access the file, return -1. If the
* user has permission, return an array with the appropriate headers. If the
* file is not controlled by the current module, the return value should be
@@ -31,7 +31,7 @@
*
* @see \Drupal\system\FileDownloadController::download()
*/
function hook_file_download($uri) {
function hook_file_download($uri): array|int|null {
// Check to see if this is a config download.
$scheme = StreamWrapperManager::getScheme($uri);
$target = StreamWrapperManager::getTarget($uri);
@@ -40,6 +40,7 @@ function hook_file_download($uri) {
'Content-disposition' => 'attachment; filename="config.tar.gz"',
];
}
return NULL;
}
/**
Loading