Control download access to files.
The hook is typically implemented to limit access based on the entity the file is referenced, e.g., only users with access to a node should be allowed to download files attached to that node.
array $file_item: The array of information about the file to check access for.
$entity_type: The type of $entity; for example, 'node' or 'user'.
$entity: The $entity to which $file is referenced.
TRUE is access should be allowed by this entity or FALSE if denied. Note that denial may be overridden by another entity controller, making this grant permissive rather than restrictive.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_file_download_access($file_item, $entity_type, $entity) {
if ($entity_type == 'node') {
return node_access('view', $entity);
}
}