Howdy!
The theme I developed for a friend is working great and I just modified items/browse.php to include the sort fields she wants. The problem is the default sort is Date Added which isn’t a field she wants to include (Title, Date and Subject are her choices).
As I can find no documentation of how to modify browse.php to set the default sort I turned to GitHub - anuragji/DefaultSort: Omeka Plugin to set the default sort for Browse Items and Browse Collections as the lone searchable solution. Unfortunately this plugin fails on its settings page so there is no save option even though the other fields display fine:
Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, false given in V:\dev\icggallery\omeka\Apache24\htdocs\plugins\DefaultSort\config_form.php:153 Stack trace: #0 V:\dev\icggallery\omeka\Apache24\htdocs\plugins\DefaultSort\config_form.php(153): in_array(1, false) #1 V:\dev\icggallery\omeka\Apache24\htdocs\plugins\DefaultSort\DefaultSortPlugin.php(68): include('V:\\dev\\icggalle...') #2 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Omeka\Plugin\Broker.php(142): DefaultSortPlugin->hookConfigForm(Array) #3 V:\dev\icggallery\omeka\Apache24\htdocs\admin\themes\default\plugins\config.php(8): Omeka_Plugin_Broker->callHook('config_form', Array, Object(Plugin)) #4 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Omeka\View.php(114): include('V:\\dev\\icggalle...') #5 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\View\Abstract.php(889): Omeka_View->_run('V:\\dev\\icggalle...') #6 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\Controller\Action\Helper\ViewRenderer.php(912): Zend_View_Abstract->render(NULL) #7 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\Controller\Action\Helper\ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript('plugins/config....', NULL) #8 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\Controller\Action\Helper\ViewRenderer.php(972): Zend_Controller_Action_Helper_ViewRenderer->render() #9 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\Controller\Action\HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch() #10 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\Controller\Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch() #11 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\Controller\Dispatcher\Standard.php(308): Zend_Controller_Action->dispatch('configAction') #12 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #13 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\Application\Bootstrap\Bootstrap.php(106): Zend_Controller_Front->dispatch() #14 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Zend\Application.php(384): Zend_Application_Bootstrap_Bootstrap->run() #15 V:\dev\icggallery\omeka\Apache24\htdocs\application\libraries\Omeka\Application.php(73): Zend_Application->run() #16 V:\dev\icggallery\omeka\Apache24\htdocs\admin\index.php(28): Omeka_Application->run() #17 {main} thrown in V:\dev\icggallery\omeka\Apache24\htdocs\plugins\DefaultSort\config_form.php on line 153
I would prefer a simple bit of PHP code I could put in the theme file that says if no query arguments to set sorting are present use this field as default. If that is somehow not possible does anyone have a working plugin that let’s me set the default sort field for items?
Thanks,
Chris