Introduce a separator in availableLetters
Closed this issue · 3 comments
I was wondering why availableLetters
has no separator...
Of cause in the normal, simple use-case a glossary represents a list of entries sorted a divided by the first letter of its titles. But extended requirements are also conceivable: e.g. rare letters could be grouped. Or there are rather fewer entries so that generally only groups of initials are required. Or - as in my case - it would be grouping by year, i.e. the symbols of my alphabet are four-digit character strings.
What's the reason for not using a separator but splitting by ''
(
glossary2/Classes/Service/GlossaryService.php
Line 189 in 743fa3a
If it really is too rare an edge case, you could perhaps hook into getAvailableLetters() per event...
I'm sure there was a separator in my first version, but I had a problem to check for the numbers in front of the string. How to replace such arrays to 0-9:
- 0,1,2,3,4,5,6,7,8,9
- 0,1,2,6,8,9
- 4,5,6
- 1,8,9
Of cause, I had found some solutions, but they are extremely long. I hate long methods. That's why I had decided to use ''
which results in a 3 lines of code solution. Perfect.
Now, 5 years later I think a simple foreach with is_number and a break on letter would be enough to solve that problem ;-)
Please give me a little bit of time to find a cool new solution
Stefan
Moin @julianhofmann
I have just added a new MergeRequest. Can you please check, if that would match your needs?
Stefan