public function ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedGetFileData in Audit Files 8.3
Same name and namespace in other branches
- 8.2 src/ServiceAuditFilesUsedNotManaged.php \Drupal\auditfiles\ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedGetFileData()
- 4.x src/ServiceAuditFilesUsedNotManaged.php \Drupal\auditfiles\ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedGetFileData()
Retrieves information about an individual file from the database.
File
- src/
ServiceAuditFilesUsedNotManaged.php, line 82
Class
- ServiceAuditFilesUsedNotManaged
- Form for Files used not managed functionality.
Namespace
Drupal\auditfilesCode
public function auditfilesUsedNotManagedGetFileData($file_id) {
// Get the file information for the specified file ID from the database.
$connection = $this->connection;
$query = 'SELECT * FROM {file_usage} WHERE fid = :file_id';
$file = $connection
->query($query, [
'file_id' => $file_id,
])
->fetchObject();
$url = Url::fromUri('internal:/' . $file->type . '/' . $file->id);
$result = Link::fromTextAndUrl($file->type . '/' . $file->id, $url)
->toString();
return [
'fid' => $file->fid,
'module' => $file->module . ' ' . $this->stringTranslation
->translate('module'),
'id' => $result,
'count' => $file->count,
];
}