public function __construct($page) { parent::__construct($page); $page->reset(); $inventory = $page->inventory(); foreach ($inventory['children'] as $dirname) { $child = new Page($page, $dirname); $this->data[$child->id()] = $child; } $sort = $page->blueprint()->pages()->sort(); switch ($sort) { case 'flip': $cloned = $this->flip(); $this->data = $cloned->data; break; default: $parts = str::split($sort, ' '); if (count($parts) > 0) { $cloned = call(array($this, 'sortBy'), $parts); $this->data = $cloned->data; } break; } }
public function delete($force = false) { // delete the page parent::delete(); // resort the siblings $this->sorter()->delete(); // remove unsaved changes $this->changes()->discard(); // hit the hook kirby()->trigger('panel.page.delete', $this); }