novagallery
novagallery copied to clipboard
Sorting options
I see in the description that galleries and images can be sorted by date or name, but what are the other options to put in the setup.php file to get the different sorts?
"sortAlbums": "newest", "sortImages": "newest",
I believe I found the answer in another post...
"newest" "oldest" "alphabetical"
Is this all of them?
Yes, currently thats all.
In v2 it will be dateASC, dateDESC, nameASC, nameDESC and random. v2 is in internal alpha testing and gets public in next few months including a better documentation.
I was just looking for the sorting options, glad I found this. Thanks for the work, the gallery is great.
Don't know if of interest, I added the "nameDESC" by adding in nova-base/lib/novaGallery.php
:
// Sort alphabetically descending
protected function orderByNameDsc($list)
{
$ascOrder = $this->orderByName($list);
$dscOrder = array();
foreach (array_reverse($ascOrder, true) as $key => $value) {
$dscOrder[$key] = ($ascOrder[$key] = $value);
}
return $dscOrder;
}
and expanding the protected function order($list, $order)
with:
protected function order($list, $order)
{
switch ($order) {
case 'defaultDSC':
// order alphabetically descending
$list = $this->orderByNameDsc($list);
break;
}
return $list;
}
After that, one can add
"sortAlbums": "defaultDSC"
in the nova-config/site.php
config.
I know, it is a little hacky, but I works. Looking forward to see v2 of the novaGallery 😄.