function uc_file_get_download_limit in Ubercart 8.4
Same name and namespace in other branches
- 6.2 uc_file/uc_file.module \uc_file_get_download_limit()
- 7.3 uc_file/uc_file.module \uc_file_get_download_limit()
Gets the maximum number of downloads for a given file.
If there are no file-specific download limits set, the function returns the global limits. Otherwise the limits from the file are returned.
Parameters
$file: A uc_file_products object.
Return value
int The maximum number of downloads.
3 calls to uc_file_get_download_limit()
- RenewFile::doExecute in uc_file/
src/ Plugin/ RulesAction/ RenewFile.php - Renews an order's product files.
- uc_file_action_order_renew in uc_file/
uc_file.rules.inc - Renews an orders product files.
- uc_file_uc_add_to_cart in uc_file/
uc_file.module - Implements hook_uc_add_to_cart().
File
- uc_file/
uc_file.module, line 976 - Allows products to be associated with downloadable files.
Code
function uc_file_get_download_limit($file) {
if (!isset($file->download_limit) || $file->download_limit == UC_FILE_LIMIT_SENTINEL) {
$file_config = \Drupal::config('uc_file.settings');
return $file_config
->get('download_limit_number');
}
else {
return $file->download_limit;
}
}