Soma Posted December 20, 2014 Posted December 20, 2014 In the admin we have an option to set a sorting for children using one field only. I have a problem with children getting sorted randomly when using a date field that is the same for multiple children. Usually we would sort by date and by ID or title, but we are only allowed to specify one field at a time. The problem with this is that once you edit one of those children, the sorting is randomly changed (actually everytime you edit a children) That's not really nice and very confusing. I had to use a dirty hook to change the children sorting one parent manually. $this->addHookBefore("ProcessPageList::find", $this, "sortingChildren"); public function sortingChildren(HookEvent $event){ $sel = $event->arguments("selectorString"); $page = $event->arguments("page"); if($page->template == "news-category"){ $event->setArgument("selectorString", $sel . ",sort=-datetime, sort=-id"); } } Maybe there's already a way I don't know or a module? But then I think this should be in core of course and not a module. Thanks. 13
Roope Posted March 12, 2018 Posted March 12, 2018 +1 for this feature! Maybe there could be a simple "custom selector" option in the dropdown with added text field.
LostKobrakai Posted March 12, 2018 Posted March 12, 2018 https://modules.processwire.com/modules/process-page-list-multiple-sorting/ 2
Roope Posted March 12, 2018 Posted March 12, 2018 55 minutes ago, LostKobrakai said: https://modules.processwire.com/modules/process-page-list-multiple-sorting/ Thanks for the info! Yeah, I've noticed this module before but I feel the same with Soma here that this should be something that's already implemented as a core feature. The idea of scattered sorting settings between template and module config seems bit complicated in a long run.
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