How would I go about removing “resource class” from the sorting dropdown on item pages? (Ie changing the first dropdown to only include “Date” and “Title”, next to the Ascending/Descending dropdown). I am not a programmer and have not been able to figure out on my own where that is defined. The theme I am using is Freedom, if that matters.
Hi nhousley,
The dropdown is built in the template file /themes/freedom/view/omeka/site/item/browse.phtml
in the following line:
<?php echo $this->browse()->renderSortSelector('items'); ?>
The renderSortSelector method is documented here.
To specify the entries that appear in the dropdown list, you can replace the ‘items’ parameter in the previous line by an array of value => label
pairs, like in the example below:
Using the original call
<?php echo $this->browse()->renderSortSelector('items'); ?>
Using a custom call
<?php echo $this->browse()->renderSortSelector(['title' => $translate('Title'), 'created' => $translate('Created')]); ?>
You can see that the “resource class” option is not present in the second screenshot.
Don’t ask me where the “numeric:timestamp” comes from, I have no idea I’m sure another expert will explain that soon
This worked like a charm! Thanks very much. For what it’s worth my version (Freedom theme v. 1.0.7) does not have the “Date (numeric:timestamp)” option showing up.
Thanks for your feedback!
The “numeric” one comes from Numeric Data Types; it allows a proper numeric sort.
Thank you for the info jflatnes. Btw, do you know if/how one can remove it from the list as it seems to bypass the renderSortSelector
method?
It gets added with an event… I’m not sure if we have a switch or something like that in the module to have it not add one.
A relevant note: we have a plan, probably for the release after this upcoming one, to add more configuration for the sort selection dropdown for sites, letting you choose what appears, the order, add more than one custom sort option, etc.
That’s great news, thanks!