Esempio n. 1
0
 public function __construct($page)
 {
     $this->kirby = $page->kirby;
     $this->site = $page->site;
     $this->page = $page;
     // make sure the inventory is always fresh
     $this->page->reset();
     $inventory = $page->inventory();
     foreach ($inventory['files'] as $filename) {
         $file = new File($this, $filename);
         $this->data[strtolower($file->filename())] = $file;
     }
     if ($this->page->canSortFiles()) {
         $sorted = $this->sortBy('sort', 'asc');
         $this->data = $sorted->data;
     }
     if ($this->page->blueprint()->files()->sort() == 'flip') {
         $flipped = $this->flip();
         $this->data = $flipped->data;
     }
 }