function _commerce_file_download_unlicensed_access in Commerce File 7
Invoke hook_commerce_file_download_unlicensed_access()
1 call to _commerce_file_download_unlicensed_access()
- commerce_file_file_download in ./
commerce_file.module - Implements hook_file_download().
File
- ./
commerce_file.module, line 788 - Provides integration of file licenses with Commerce
Code
function _commerce_file_download_unlicensed_access($file, $account = NULL, $licenses = array()) {
global $user;
$account = isset($account) ? $account : $user;
$licenses = !empty($licenses) ? $licenses : array();
// Invoke hook and collect grants/denies for download access.
// Default to FALSE and let others overrule this ruling.
$grants = array(
'commerce_file' => FALSE,
);
$grant_hook = 'commerce_file_download_unlicensed_access';
foreach (module_implements($grant_hook) as $module) {
$grants = array_merge($grants, array(
$module => module_invoke($module, $grant_hook, $file, $account, $licenses),
));
}
// Allow other modules to alter the returned grants/denies.
drupal_alter($grant_hook, $grants, $file, $account, $licenses);
return $grants;
}