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 {
    • This doesn't return an int. I think a followup is needed to add an example of returning an int here. Maybe that could be combined with the doc updates that were removed to keep this in scope?

Please register or sign in to reply
// 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