From d35464dbab064e1d6b3d98981e5cb68bc4494690 Mon Sep 17 00:00:00 2001 From: Jeroen Dalsem Date: Tue, 3 Sep 2024 09:50:01 +0200 Subject: [PATCH] fixed: remove sort query element on other sorting menu items --- classes/ColdTrick/GroupTools/Menus/FilterSortItems.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/classes/ColdTrick/GroupTools/Menus/FilterSortItems.php b/classes/ColdTrick/GroupTools/Menus/FilterSortItems.php index 45bdd97..a7ebb88 100644 --- a/classes/ColdTrick/GroupTools/Menus/FilterSortItems.php +++ b/classes/ColdTrick/GroupTools/Menus/FilterSortItems.php @@ -27,6 +27,15 @@ public static function registerPopularSorting(\Elgg\Event $event): ?MenuItems { /* @var $result MenuItems */ $result = $event->getValue(); + /* @var $menu_item \ElggMenuItem */ + foreach ($result as $menu_item) { + if ($menu_item->getParentName() !== 'sort:parent') { + continue; + } + + $menu_item->setHref(elgg_http_remove_url_query_element($menu_item->getHref(), 'sort')); + } + // add sorting based on relationship time_created $result[] = \ElggMenuItem::factory([ 'name' => 'popular',