Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The permissions page appears to be in alphabetical order by internal module name rather than displayed module name. This makes it very difficult to scroll through and find permissions for a module. For instance, the Content Translation module (translation.module) is listed with the T section instead of in the C section.
Comment | File | Size | Author |
---|---|---|---|
#13 | 647250-permissions-page-not-alphabetical-rev3.patch | 2.01 KB | brianV |
#10 | 647250-permissions-page-not-alphabetical-rev2.patch | 802 bytes | brianV |
#1 | 647250-permissions-page-not-alphabetical.patch | 2 KB | brianV |
Comments
Comment #1
brianV CreditAttribution: brianV commentedPatch attached which *should* sort these alphabetically.
Comment #2
brianV CreditAttribution: brianV commentedoops, forgot to set to CNR.
Also, there are some whitespace fixes in there that my IDE threw in.
Comment #3
jhodgdonbrianV - will this work correctly if the page is displayed in another language? i.e. it needs to sort by the actual name that will be displayed (translated into the interface language). I don't know if your patch is doing that or not?
Comment #4
jhodgdonThe whitespace changes are all good, by the way (removing spaces that were at the end of lines).
I will test this shortly to see if it works with translation. And in general.
Comment #6
jhodgdonThis patch seems to totally break the permisisons page -- all I can see is Forum permissions, and all the other modules' permissions went away.
Comment #7
brianV CreditAttribution: brianV commented@jhodgon: It should work with translation, since the text it's sorting on is the display text.
I am going to take a look at these fails...
Comment #8
jhodgdonJust as a note, without any patch, the order I am currently seeing on the Permisisons page is (I think I have all the core modules turned on, as I've been working on help screens) (and it's a fresh CVS update and install from this morning):
Block, Aggregator, Book, Comment, Contact, Dashboard, Filter, Image, Locale, Menu, Node, Path, PHP Filter, Poll, Search, Shortcut, Testing, Statistics, System, Taxonomy, Toolbar, Content Translation, Upload, User, Forum.
It's hard to tell what is determining that order -- it's not in machine-name order either!
Comment #9
jhodgdonIt looks like module_implements() has a $sort=TRUE parameter you can pass to make the list sorted by module name...
http://api.drupal.org/api/function/module_implements/7
Comment #10
brianV CreditAttribution: brianV commented@jhodgon:
By default, the modules called are ordered by weight and filename. A simple change to the call to module_implements (as in the attached patch) orders them by machine name, which is a good improvement for starters.
Still looking at why the initial patch failed, though, as that's obviously the optimal approach.
Comment #11
jhodgdonI think what you are trying to do, sorting by $module->name, is hte same as what module_implements($sort = TRUE) does. However, this field $module->name is coming straight from the database and is NOT translated.
So you need to do something other than that, for it to work with translations.
Actually, I'm not sure where the translation of all of that permissions text is happening, come to think of it, or even if it is happening. Hopefully?
Comment #12
jhodgdonI also think that sorting by machine name is not much of an improvement.
Comment #13
brianV CreditAttribution: brianV commentedI must be asleep at my desk. The attached patch should work to properly alphabetize the modules by display name.
With respect to translation, I recall other issues where that was hashed over. The consensus is that module names shouldn't be translated as they are proper names.
I think this patch should do it for this issue; translation of module names on the permissions page should be split off into it's own issue and debate.
Edit: Here is the module name translation debate issue: #632896: Rollback translation of module names
Comment #14
jhodgdonThis patch works for me, looks good, etc.
I am not going to re-open the translation can of worms -- I stand corrected (or at least overruled). :)
Comment #15
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.