Closed cgundermann closed 4 years ago
Might this be the same issue as https://github.com/getkirby/kirby/issues/2342?
@distantnative I've tested Your suggestion as mentioned here and replaced
// kirby/config/sections/files.php
elseif ($this->sortable === true) {
$files = $files->sortBy('sort', 'asc', 'filename', 'asc');
}
with
// kirby/config/sections/files.php
else {
$files = $files->sortBy('sort', 'asc', 'filename', 'asc');
}
which seems to work fine. If You remove the the sortBy method in the album controller of the starterkit, everything works as expected.
Edit: If You leave the sortBy method in the album controller, then the files are sorted in a weird order again.
@CrisGraphics Sorry, I totally missed your comment - only stumbled across it today again.
So I think it is https://github.com/getkirby/kirby/pull/2878 but what you describe is probably just related to the controller. If the files should be shown as in the Panel, we need to apply the same sorting (adding filename
):
$gallery = $page->images()->sortBy('sort', 'filename');
✅
Thanks for having a look into it again @distantnative! I'm happy, that this will be solved in 3.5. You guys are awesome! 🥳
Good morning!
Describe the bug
Images with no 'sort' field are being displayed in a different order than shown in the panel.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Right after the upload process, images on the frontend should automatically be sorted in the same order as shown in the panel.
Kirby Version
3.3.6 (but noticed this in older versions as well)
Additional context
Right now I'm solving it like so, but in my opinion it would be nice to have it as a default behavior:
Thanks! 🙂
PS: Haven't tested this with other file types (docs, videos etc.) yet.