New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort menus in the backend menu alphabetically #5683
Conversation
@@ -139,7 +139,8 @@ | |||
$menu->addSeparator(); | |||
|
|||
// Menu Types | |||
foreach (ModMenuHelper::getMenus() as $menuType) | |||
$menuTypes = JArrayHelper::sortObjects(ModMenuHelper::getMenus(), 'title'); | |||
foreach ($menuTypes as $menuType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hackwar can you add a line bevor the foreach
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@test Success. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5683. |
I get the following error
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5683. |
Ooops: I have the same, haven't seen it when testing before (blush). This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5683. |
Sorry, fixed that one. I even looked at the source of JArrayHelper::sortObjects() and saw the reference, but missed it... |
@test Success. Works now without PHP warnings after correction. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5683. |
@test the Strict standards issue has now been fixed. I now see that this change isnt applied in Hathor. Not sure if that uses an override ? This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5683. |
@brianteeman Yes, I just see Hathor has an override mod_menu/default_enabled.php. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5683. |
Not sure I like this one. In my multilingual test site, the menus which were created one language after the other are now disordered. Also, the sorting done in this PR is different in mod_menu vs the dropdown in "Menu Manager: Menu items" mod_menu Dropdown If it was decided to alpha sort the menus, the second solution is much better imho can be used instead, to solve at least the case sensitive issue (IF we sort alpha) we would get instead of changing locale to false has apparently no effect here. |
I've changed the sorting to be case-insensitive and added the change to Hathor, too. I also first thought I enabled the local-aware sorting, but then noticed that that feature is actually implemented pretty stupidly... I would have to hand in the locale by which to sort and not simply true or false and quite frankly, the amount of code that would have to be written to do this properly is simply not worth the gain we maybe would get. As far as I can see, it would only make sure that letters like o and ö would be grouped next to each other in German for example. However, I think that it already orders via UTF8 and I guess that that takes care of this already anyway... Mind you, that is not based on hard facts, but a hunch. 😉 In any case, I guess this is now ready for final testing/merging, depending on if this is actually a wanted feature. However, if we don't do this, we should remove the ordering in the menu manager filter dropdown to keep this consistent. |
I agree it should be consistent, thus why I proposed the code. |
@test all works well for me - thanks for this @Hackwar
I dont see this filter? This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5683. |
if you go into the list view of a menu in the menu manager, you can switch between the menus that are displayed. That is the dropdown that I'm talking about. |
Ah gotcha
|
Fine here. Merging. Thanks. |
Sort menus in the backend menu alphabetically
This PR sorts the menutypes in the backend in alphabetical order and not in order how they were first created some ancient time ago. 😉
How to test