Problem/Motivation
Original GH issue: https://github.com/nuvoleweb/ui_patterns/issues/331
Original GH PR: https://github.com/nuvoleweb/ui_patterns/pull/332
I have a lot of patterns now and the list of patterns is not sorted alphabetically (not sorted at all?)
I'd like to have patterns at least sorted by id asc :-)
Issue fork ui_patterns-3311342
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3311342-sort-patterns-library
changes, plain diff MR !3
Comments
Comment #3
grimreaperComment #5
grimreaperCompared to GH, I have updated the PR with the code review comment taken into account.
Comment #6
duaelfrI'm afraid it will be confusing that the list is sorted by some invisible data.
Plus, it's going in the opposite direction of #3311464: Sort UI Pattern definitions that I've been using on my projects for a long time. Should we introduce a settings somewhere to allow sorting to be configured? Should we replace that list of links by a tablesort showing the label and the id?
Comment #7
g4mbiniComment #8
grimreaperThanks @DuaelFr to point this out.
I think we should agree on a mecanism and stick to it because I have the same problem on UI Styles: #3314936: Sort styles alphabetically in the library
I am not in favor of a settings. Let's keep as much as possible the UI Suite ecosystem settingsless as possible. To be only API.
And I do not think that there is enough space for a tablesort. Also @pdureau told me that maybe one day it will be a good idea that the listing of patterns that do the summary could be extracted as a block plugin to not be linked to the library page.
So we have stuff to discuss.
From what I see from the PR linked in the linked issue, it is based on a category key with a fallback on module label (themes seems to not be handled in CategorizingPluginManagerTrait). In the end it is the plugin label that is used for sorting, if I am not mistaken.
I agree that a sort on something the site builder cannot see can be confusing but I had in mind in case of translation, the sort will be different from one language to the other but maybe that is not important.
Comment #9
g4mbiniComment #10
pdureau commented> I am not in favor of a settings. Let's keep as much as possible the UI Suite ecosystem settingsless as possible.
I totally agree with that :)
> I agree that a sort on something the site builder cannot see can be confusing but I had in mind in case of translation, the sort will be different from one language to the other but maybe that is not important.
This doesn't look like a blocking point.
Also, some teams, including mine, are sometimes putting plugin labels in between parenthesis for internal/private use. How the sorting will work for them?
Comment #11
grimreaperIf sorting acts on labels by alphabetical order, then all internal/private patterns will appear first if in parenthesis.
And will appear in last position if prefixed by an underscore. But I don't see it elegant the underscore in the pattern label, in the machine name I can understand but would prefer to avoid too).
Comment #12
grimreaperDiscussed in monthly meeting: sort by label and try to find a sort algorythm that ignores parenthesis.
Comment #13
grimreaperUpdate issue title.
Comment #14
grimreaperClosing in favor of #3311464: Sort UI Pattern definitions.
Finally making the change in the UI patterns manager will impact the library too.