Currently (and for years) the sorting of items in the admin menu (/admin) has been incorrect if an item started with multiple capital letters. For example, SMTP comes before "Save", "Search", and "Site". I know it seems trivial, but the total number of minutes I've spent going to enable modules I thought were missing actually adds up to something over the years.

Our users expect that when something appears to be sorted, it will be sorted correctly.

I have attached two screenshots and a patch for this. There's a "before" screenshot, where you see the menu entry "SZZZ*" come before "Site Information". There's an "after patch" screenshot, showing it sort correctly, and there's a patch.

The patch just sorts the items by title before outputting them.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drewish’s picture

Status: Active » Needs work

Subscribing. As the maintainer of the iTunes module I've been annoyed by this for quite a while, my module always ends up at the bottom of the settings list.

Though I think we can use PHP's natcasesort() and avoid the helper function.

chx’s picture

patch is without -p, i can't really review it. i would think you want to fiddle in menu.inc with $new_tree[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $tree[$key]; which then goes to be ksorted but then that will affect every menu tree if you lowercase the title in there.

rfay’s picture

Thank you for the reviews and the suggestions. I found a far better way to do this (suggested by chx, but in a different place). Now it's a one-line patch, and it affects only the presentation of the admin menu. I'd appreciate it if you could take another look.

The new patch does nothing but drupal_strtolower() the artificial array key that's being used for menu generation.

drewish’s picture

Status: Needs work » Needs review

humm.... that looks really good. i haven't had a chance to apply it and test it but lets update the status and get the testbot feedback.

Dries’s picture

Looks good to me too. drewish, do you have a change to test this out?

drewish’s picture

Title: Admin page sorting is incorrect when title contains CAPS; Usability issue » Menu item sorting should be case in-sensitive; Usability issue
Status: Needs review » Needs work
FileSize
124.88 KB

maybe i was testing it wrong but i just went into the menu settings and renamed the "Image toolkit" menu item to "image toolkit" but the sorting was still wrong:

rfay’s picture

@drewish: The admin menu is cached. I assume you cleared your cache?

rfay’s picture

@drewish: The test scenario you tried is an excellent one (just go to admin/structure/menu-customize/management and change the name of "Image Toolkit" to "image toolkit". Without the patch, it drops to the bottom of the menu.) But I just did it (clean D7, applied patch from #3) and got the expected results. See screenshot. Could you just verify your setup? Thanks!

drewish’s picture

Status: Needs work » Reviewed & tested by the community

doh. i had applied the patch to the wrong site. this works beautifully.

webchick’s picture

Version: 7.x-dev » 6.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

That's a nice little improvement! Committed to HEAD.

Moving back to 6.x for consideration. Patch doesn't apply for me.

rfay’s picture

Status: Patch (to be ported) » Needs review
FileSize
630 bytes

Here's the D6 version. A no-brainer.

rfay’s picture

ping... @drewish, perhaps you can look at this and we can get it RTBC'd so we can get rid of this annoyance in D6.

cweagans’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, patch applies, code works.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Committed to Drupal 6, thanks!

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix, -#d7ux

Automatically closed -- issue fixed for 2 weeks with no activity.