Closed ryanmitchell closed 1 year ago
I think I noticed it was because title
was being saved to the settings for sort_field
. If nothing was saved, it would have worked fine. I think it happened during import.
The logic should be, if there's a sort field, use that.
Hmm, I noticed on a site we didn't do any imports from (set up collections in eloquent). Its being saved to the DB here: https://github.com/statamic/eloquent-driver/blob/85020494c573a6b2d0fc22c31351522defa7ade6/src/Collections/Collection.php#L33 and ours was saved as 'title' too.
Ok not the importer then, but somewhere. 😄
Should we just not be saving sortField?
Maybe we should only save it if it's "custom". ie not order
for orderable collections, not date
for date collections, or title
. (Following the logic of the line I linked to before)
On the file driver, it doesn't get saved - because there's not even a field for it on the collection config screen. The only way to customize it is to put it in the yaml.
Oh maybe it’s just my error in saving it in the first place. I think we should just not save it and let the default behaviour happen.
As reported over on Discord the orderable collection view doesn't default to
order
sorting.So by default we need to save the
sort_field
asorder
in the database for these collections.