We have a site that will display linked records, and a couple of those records have hundreds of linked records. Right now the linked records seem to display based on the order on the back end, and I would like them to sort by the dcterms:date on the linked record.
We have figured out how to sort by the title of the linked record, but that’s not quite enough, since the title sometimes but does not always match the date.
I want to get an idea if this is possible before I have someone manually re-order all the linked items on the back end.
We attempted to solve this problem by making changes in the php code of view/common/resource_values.phtml (with some help from Codex). At first I sorted by converting the displayTitle to a date format and sorted chronologically. However, displayTitle is not guaranteed to be reliable. Then I changed it to query the API for the ID of the linked item, look up the linked item’s dcterms:date, and sorted by that value. It was necessary to query the API, because it is not possible to see the linked item data from the API representation of the original item (you can only see the ID and the displayTitle). I seems like the PHP solution we came up with is working.