function fillpdf_file_usage in FillPDF 7
Helper function to find out if FillPDF manages this file.
Parameters
object $file: The file object.
Return value
array|bool The file_usage record if FillPDF manages this file, or FALSE if it doesn't.
File
- ./
fillpdf.module, line 2251
Code
function fillpdf_file_usage($file) {
// If no other modules have re-used the FillPDF file and increased the
// count, there should only be one usage. In any case, we only handle
// the fillpdf_file type. As long as one of the matching file contexts
// matches, we permit access. If you're a module author that wants to
// use the generated FillPDF files for other purposes, please use a
// unique type in {file_usage} and implement hook_file_download() in
// your own module for more control.
$usage = file_usage_list($file);
foreach ($usage as $module => $per_module) {
if ($module === 'fillpdf') {
foreach ($per_module as $type => $per_id) {
return $per_id;
}
}
}
return FALSE;
}