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 theme autocomplete list on the help topic editing form doesn't seem to be ordered in any way.
The module and topic autocompletes are in alphabetical order by human name, which is good, but the theme list seems to be random.
Comment | File | Size | Author |
---|---|---|---|
#11 | 2923918_theme_autocomplete_sort-11.patch | 1009 bytes | andypost |
#8 | 2923918_theme_autocomplete_sort.patch | 387 bytes | Amber Himes Matz |
#6 | Edit Accessibility features | Config Help Sandbox 2017-12-28 15-23-36.png | 155.56 KB | Amber Himes Matz |
Comments
Comment #2
Amber Himes MatzComment #3
jhodgdonJust a note that there is a test for the theme autocompletes in tests/src/Functional/HelpTopicAdminTest in method testAutocomplete(), and if you fix this bug, you may need to modify the order of expected return values in the tests.
Hm. It looks like both the module and topic autocomplete lists are alphabetical by machine name. Which is probably OK to leave as they are?
Comment #4
Amber Himes MatzHey @jhodgdon, should I hold off on attempting this until the dust settles on #2926651?
Comment #5
jhodgdonNo, I think it's fine to work on this now. It shouldn't conflict or intersect. Thanks!
Comment #6
Amber Himes MatzFinally getting around to this!
But I want to make sure I'm looking in the right place. Are we talking about the "Theme dependencies" field? Because on the topic editing form, in the Dependencies fieldset, the Theme dependencies autocomplete looks like it's returning an alphabetically ordered list.
See attached screenshot. Am I in the right place @jhodgdon?
Comment #7
jhodgdonYes, that's it. I wonder if it is always alphabetical, or just sometimes alphabetical? Certainly when I created this issue, I thought it wasn't alphabetical.
So I think we still need to add a line or two of code to make sure it is alphabetical. Just sort the array of possibilities returned by the autocomplete controller's theme method.
Comment #8
Amber Himes MatzOk, here's a patch which should sort the theme autocomplete results alphabetically.
Comment #9
Amber Himes MatzComment #10
andypostI'm not sure this is right way and we need to reconsider mapping internals to UI
when we do search in
- topics (id,label) we use
sort('label')
and results already ordered by Human name of topic- modules - returned by weight in system
- themes are ordered ...
\Drupal\Core\Extension\ExtensionDiscovery::scan()
so comment tellsSo surely we have no weight system then label is best choice to sort themes
PS: do we include profiles into list of modules? or separate thing? cos extension system finally has api
that happens in
\Drupal\help_topics\Controller\AutocompleteController::themeAutocomplete()
Comment #11
andypostHere's my vision, we need sort before search to return more narrow results
Comment #12
andypostAnd needs coverage by kernel test or kinda
Comment #13
andypostGetting modules & themes with ordering has patch in #2943920-3: Use newer API for getting module info