Hi,
The function that controls the order of the entities within a collection is located in /class/collection.php, updateContetnElements(). By default, it is doing this:
// iterate through the new list of entities
foreach($this->contentElements as $contentElement) {
// append each entity to the end of the existing list of entities
$data[] = array(
'href' => $contentElement
);
}
$data contains the existing list of entities (can be empty), and $this->contentElements have the newly added list of entities. If you wish to prepend the new list of content elements, here's one of the ways you can do that:
// iterate through the new list of entities
foreach($this->contentElements as $contentElement) {
// prepend each entity to the top of the existing list of entities
array_unshift($data, array('href' => $contentElement));
}