public function getInitialPreviewConfig()
{
$initialPreviewConfig = [];
$userTempDir = $this->getModule()->getUserDirPath();
foreach (FileHelper::findFiles($userTempDir) as $file) {
$filename = basename($file);
$initialPreviewConfig[] = ['caption' => $filename, 'url' => Url::to(['/attachments/file/delete-temp', 'filename' => $filename])];
}
foreach ($this->getFiles() as $index => $file) {
$initialPreviewConfig[] = ['caption' => "{$file->name}.{$file->type}", 'url' => Url::toRoute(['/attachments/file/delete', 'id' => $file->id])];
}
return $initialPreviewConfig;
}