designtopack/public/site/plugins/helpers/index.php
2024-10-23 11:33:56 +02:00

21 lines
No EOL
471 B
PHP

<?php
function getFileData($file) {
$data = [
'url' => $file->url(),
'uuid' => (string) $file->uuid(),
'name' => $file->filename(),
'type' => (string) $file->type(),
];
if ($file->description()->exists()) {
$data['description'] = $file->description()->value();
$data['tags'] = $file->tags()->split();
};
if($file->comments()->exists()) {
$data['comments'] = Data::decode($file->comments()->value(), 'yaml');
}
return $data;
}