public function getFiles() { /** Should we cached find result? */ $files = $this->mediaManager->find($this->fileFilter); if ($files instanceof IFile) { //just single file return [$files]; } else { return $files; } }
public function render() { $this->template->setFile(__DIR__ . DS . 'templates' . DS . 'grid.latte'); $this->template->mediaManager = $this->mediaManager; try { $this->template->files = $this->mediaManager->find($this->currentFilter); } catch (\vojtabiberle\MediaStorage\Exceptions\FileNotFoundException $e) { $this->template->files = []; } $this->template->render(); }