How can one change the default behaviour in the browse items page (/s/site/item)? As it is now the items are by default sorted by ‘created’. I’d like them sorted by title by default, or an easy-ish way to control that behaviour.
I can’t find it in application/view/common/sort-selector.phtml. I’ve found it for the browse preview (src/Site/BlockLayout/BrowsePreview.php), not for the full browse.
I know I can append ?sort_by=title to the address. But then when the user does an advanced search and clicks the ‘search’ button the custom behaviour is restored (unless I append the parameters with some JavaScript or edit the ‘search’ action).
Any help would be very appreciated.
Thanks to ManOnDaMoon on https://forum.omeka.org/t/default-selected-option-in-browse-item-view/10876 for the solution to this. The file application/src/Controller/Site/ItemController
contains a function called browseAction()
with this default:
$this->setBrowseDefaults('created');
By changing it to:
$this->setBrowseDefaults('title', 'asc');
I now have the list of items ordered by title, ascending.