It means for example "Content translation" is sorted after it's internal name "translation".
It appears Drupal core had a similar problem once, but only on the permissions page: #647250: Permissions page not in alphabetical order.
Otherwise thank you so much for this module. It's always among the first I install on every Drupal site I create.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 1241662-module-sorting-5.patch | 1.56 KB | Niklas Fiekas |
| #1 | 1241662-module-sorting-1.patch | 1.52 KB | Niklas Fiekas |
Comments
Comment #1
Niklas Fiekas commentedFound this quite annoying, so I am setting this to normal. Please review my patch.
Comment #2
LarsKramer commentedHi Niklas, that was quick! I applied your patch and confirm it is working.
However, maybe this could be done in a better way? I don't have much coding experience, so please bare with me, but to me it doesn't make sense sorting this list when it has already been sorted in core system.module using the same type of callback. Wouldn't it be possible to pass the original array without having to sort it again?
I looked at #1023252: UI should utilize Drupal 7 core more - new 7.x-2.x branch? which I think is related to this issue.
Actually, to get vertical tabs on the module list can be done by adding only two lines in system.admin.inc:
Both ones added inside function 'system_modules', the second one inside the loop which creates the package fieldsets.
However, I am not sure how easy it would be to implement this in module_filter. I guess it would require a lot of removing and rewriting code to get the filter functions working also.
Comment #3
Niklas Fiekas commentedHi, thank you for pointing that out. I don't know module_filter very well, so I just did the obvious thing: replace ksort with custom sorting:
However, if the system module will be used more in the future, there might be a better fix than my "quick" one.
Comment #4
greenskin commentedI like the patch other than it needs to degrade to return 0 if the statement is FALSE. e.g. http://api.drupal.org/api/drupal/includes--common.inc/function/element_s...
@LarsKramer Unfortunately the default way system module sorts the modules is by package then alphabetically within each package (at least in the case for Drupal 6. I haven't dug very deep into Drupal 7 yet). Module Filter (for the tabs view, configurable on the settings page) needs all the modules to be sorted alphabetically together, not only within each package. The way the tabs then work is by hiding the modules that don't belong in the group.
Using the core vertical tabs is something I would like to consider at least as an optional setting. The problem with using it rather than the current tabs implementation is it would require to either filter within the active tab OR filter based on all. The current tabs implementation lets you filter on modules within the active tab, and provides a tab that contains all modules. I was originally developing this module (the 6.x branch) 'round the time that vertical tabs for Drupal 6 was hitting its stride, and I felt it was easiest to provides tabs that when clicked would simply show/hide the necessary rows rather than hack a workable method in order to use Vertical Tabs.
Comment #5
Niklas Fiekas commentedCorrected the patch as you suggested. I think returning nothing (and thus NULL) would have had the same effect, but it looks a bit cleaner to do it as you say.
Comment #6
LarsKramer commented@greenSkin: Thanks for the explanation about the vertical tabs. I might take a look at it myself when I get time to see how it could get implemented. Your module is no sot complex so it's a good starting point for someone like me learning to code.
I have been looking a bit more into the core code in system.admin.inc, and I think you are right: There is no way to get the complete sorted list, only per package. Although it starts sorting the complete list of modules by displayed name, it later builds the form array by package only.
Comment #7
greenskin commentedCommitted.