How to sort recources in modx api. To use in a snippet. I load the recources with this code.
$childIds = $modx->getChildIds($id);
$docs = $modx->getCollection('modResource', array(
'id:IN' => $childIds
));
It get all the recources within the parent $id
Something like this:
$childIds = $modx->getChildIds($id);
$criteria = $modx->newQuery("modResource");
$criteria->where(array("id:IN" => $childIds));
$criteria->sortBy("menuindex", "ASC");
$docs = $modx->getCollection('modResource', $criteria);