/** * Sorts file attachments. */ public function onSortAttachments() { if ($sortData = post('sortOrder')) { $ids = array_keys($sortData); $orders = array_values($sortData); $file = new File(); $file->setSortableOrder($ids, $orders); } }