/**
  * Handle the columns.
  *
  * @param FileTableBuilder $builder
  */
 public function handle(FileTableBuilder $builder)
 {
     $builder->setColumns(['entry.preview' => ['heading' => 'anomaly.module.files::field.preview.name'], 'name' => ['sort_column' => 'name', 'wrapper' => '
                 <h4>
                     {value.link}
                     <br>
                     <small>{value.disk}://{value.folder}/{value.file}</small>
                     <small>{value.size}{value.keywords}</small>
                 </h4>', 'value' => ['file' => 'entry.name', 'link' => 'entry.edit_link', 'folder' => 'entry.folder.slug', 'keywords' => 'entry.keywords.labels', 'disk' => 'entry.folder.disk.slug', 'size' => function (FileInterface $entry) {
         if (!in_array($entry->getExtension(), config('anomaly.module.files::mimes.thumbnails'))) {
             return null;
         }
         return '<span class="label label-info">' . $entry->getWidth() . ' x ' . $entry->getHeight() . '</span>';
     }]], 'size' => ['sort_column' => 'size', 'value' => 'entry.readable_size'], 'mime_type', 'folder']);
 }
 /**
  * Return the browser index.
  *
  * @param BrowserTableBuilder $browser
  * @param DiskTableBuilder    $disks
  * @param FolderTableBuilder  $folders
  * @param FileTableBuilder    $files
  * @param null                $disk
  * @param null                $path
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function index(BrowserTableBuilder $browser, DiskTableBuilder $disks, FolderTableBuilder $folders, FileTableBuilder $files, $disk = null, $path = null)
 {
     /**
      * If a disk is selected then don't include them
      * but add them to the file and folder tables.
      */
     if ($disk && ($disk = $this->disks->findBySlug($disk))) {
         $this->dispatch(new AddDiskBreadcrumb($disk));
         $browser->addTable('folders', $folders->setDisk($disk));
         $browser->addTable('files', $files->setDisk($disk));
     } else {
         $browser->addTable('disks', $disks);
     }
     /**
      * If we have a path available then find the folder
      * and add it to the folder and file tables.
      */
     if ($disk && $path && ($folder = $this->folders->findByPath($path, $disk))) {
         $this->dispatch(new AddFolderBreadcrumbs($folder));
         $files->setFolder($folder);
         $folders->setParent($folder);
     }
     return $browser->render();
 }
Example #3
0
 /**
  * Display an index of existing entries.
  *
  * @param FileTableBuilder $table
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function index(FileTableBuilder $table)
 {
     return $table->render();
 }