/**
* Get files of target used
*
* @param string $targetId target identifier
* @return File[]
*/
public function getFiles($targetId)
{
$data = [];
$fileClass = $this->storage->getModel();
$files = $fileClass::getByFileable($targetId);
foreach ($files as $file) {
$thumbnails = null;
if ($this->mediaManager->is($file)) {
$imgClass = $this->mediaManager->getHandler(Media::TYPE_IMAGE)->getModel();
$thumbnails = $imgClass::getThumbnails($this->mediaManager->make($file), static::THUMBNAIL_TYPE);
}
$file->setRelation('thumbnails', $thumbnails);
$data[] = $file;
}
return $data;
}