Hello,
I have just installed version 4 of omeka S. I would like to add values in the selection for items navigation as shown here: View Helpers - Omeka S Developer Documentation
I added an array “$sortHeadings” which I called with
<?php echo $this->browse()->renderSortSelector($sortHeadings ); ?>
$sortHeadings = [
[
label’ => $translate(‘Created’),
value’ => ‘created’
],
[
label’ => $translate(‘Title’),
value’ => ‘dcterms:title’
],
[
label’ => $translate(‘Creator’),
value’ => ‘dcterms:creator’
],
[
label’ => $translate(‘Date’),
value’ => ‘dcterms:date’
],
];
But omeka returns an error.
Can you help?
Thanks in advance
David
Hi @david.de ,
If you could share the error it would help a lot. You can enable errors Retrieving Error Messages - Omeka S User Manual
With that said, I’m assuming that you have the $sortHeadings variable declared before passing it to the rederSortSelector method and you’re not missing single quotes in your code for the array keys.
However, looking at the Omeka S code, it appears that the array should be structured like this:
[
'<sort_by_param_1>' => '<Sort by label 1>',
'<sort_by_param_2' => '<Sort by label 2>',
]
So you your code should look like this:
<?php
$sortHeadings = [
'created' => $translate('Created'),
'dcterms:title' => $translate('Title'),
'dcterms:creator' => $translate('Creator'),
'dcterms:date' => $translate('Date'),
];
?>
<?php echo $this->browse()->renderSortSelector($sortHeadings); ?>
Hello @fackrellj ,
Thank you very much for your help, it works now!
Best regards,
David