taotoo Posted February 17, 2022 Share Posted February 17, 2022 I've appended the following line from wire\modules\Process\ProcessPageSearchLive.php: $selectors[] = "start=$liveSearch[start], limit=$liveSearch[limit]"; Like this: $selectors[] = "start=$liveSearch[start], limit=$liveSearch[limit], sort=template|-created"; But rather than modify the original file, is it possible to achieve the same with a hook? Link to comment Share on other sites More sharing options...
Robin S Posted February 17, 2022 Share Posted February 17, 2022 7 hours ago, taotoo said: sort=template|-created That doesn't look like the correct syntax for setting multiple sorts in a selector string. I think it should be "sort=template, sort=-created"https://processwire.com/docs/selectors/#sort To apply it to the admin search using a hook: $wire->addHookAfter('ProcessPageSearch::findReady', function(HookEvent $event) { $event->return .= ', sort=template, sort=-created'; }); 1 2 Link to comment Share on other sites More sharing options...
taotoo Posted February 18, 2022 Author Share Posted February 18, 2022 8 hours ago, Robin S said: That doesn't look like the correct syntax for setting multiple sorts in a selector string. I think it should be "sort=template, sort=-created"https://processwire.com/docs/selectors/#sort To apply it to the admin search using a hook: $wire->addHookAfter('ProcessPageSearch::findReady', function(HookEvent $event) { $event->return .= ', sort=template, sort=-created'; }); Thank you very much Robin! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now