public function browse(Request $request, $namespace, $path)
{
$directory = $this->filesystem()->getDir("{$namespace}://{$path}");
try {
$it = $directory->getContents();
} catch (IOException $e) {
$msg = Trans::__('page.file-management.message.folder-not-found', ['%s' => $path]);
$this->logException($msg, $e);
$this->flashes()->error($msg);
$it = [];
}
$files = array_filter($it, function (HandlerInterface $handler) {
return $handler->isFile();
});
$directories = array_filter($it, function (HandlerInterface $handler) {
return $handler->isDir();
});
$context = ['directory' => $directory, 'files' => $files, 'directories' => $directories, 'multiselect' => $request->query->getBoolean('multiselect')];
return $this->render('@bolt/async/browse.twig', ['context' => $context], ['title', Trans::__('page.file-management.message.files-in', ['%s' => $path])]);
}