There are many instances where having an alphabetical pager (A, B, C) makes more sense than a numeric one (1, 2, 3).. for example, when browsing users or terms.
There are a couple places in contrib where modules have had to implement their own alpha pager. It would be nice if core offered this natively.
Issue fork drupal-68882
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:
Comments
Comment #1
bitman commentedThe Views Alpha Pager module is worth noting here.
Comment #2
pasqualleComment #3
dugh commentedno drupal 6 version of that module
Comment #4
wulff commentedHaving an alphabetic pager in core sounds like a great idea.
Comment #5
jhedstromThis might be possible with Views as-is, but I'm not certain.
Comment #12
matsbla commentedHere is also another contrib project #2821493: [alpha_pagination] D8 Port
Comment #22
johnvComment #23
johnvIIRC the Book module has an alphabetically sorted pager.
Or else the Glossary
At least, IN D7, you could create a telephone book with names, and an alphabetical pager.
Let's re-find the contrib / deprecated core pager.
See Search on Drupal Answers… New Stack Overflow Jobs mogelijk gemaakt door Indeed: techbanen binnen handbereik (Nu beschikbaar in Nederland) Zoek vacatures Drupal Answers Home Questions Tags Users Jobs New Companies Unanswered Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Or just enable/copy/override the core 'Glossary' view (by default disabled) , enabling the '/glossary' page as an example.
Comment #24
johnvComment #26
byski commentedLooking at this from a fresh angle on Drupal 12 (main branch)
The query-layer groundwork for this already exists in core. StringArgument has a glossary option that runs SUBSTRING(field, 1, N)
to group results by first character, and the DefaultSummary style renders those as letter links. The demo Glossary view
(/glossary) uses exactly this today.
The actual gap is in the rendering layer, not the query layer:
- The summary only lists letters that have matching content. A full A-Z bar never renders.
- Empty letters have no disabled/inactive state. They simply vanish.
- It is a drill-down pattern (all letters first, then click to see items), not a persistent navigation bar that stays visible
above/below the result list with the active letter highlighted.
- There is no reusable element you can attach to a users view or taxonomy terms view without adopting the summary pattern
wholesale.
Proposed approach: a new summary style plugin
Rather than a new @ViewsPager plugin (pagers are offset-based; "page = letter" is really a filter, so that layer is wrong), I
would add:
1. A new summary style plugin, e.g. AlphabeticalSummary, that takes the letters-with-content from the existing glossary query and
merges them against a configurable full character set (A-Z, 0-9, a catch-all "other"), marking each letter as present, empty, or
active.
2. A Twig template for the rendered bar.
3. A small CSS library for the active/disabled states.
4. Config schema for the style options (which character sets to include, whether to show or hide empty letters).
5. Update the shipped Glossary view to use the new style as the in-core demonstration.
6. Functional tests asserting the full alphabet renders, empties are marked correctly, the active letter is highlighted, and the
links filter content as expected.
This approach leaves StringArgument and the query path untouched. It lives entirely in the rendering layer, which means it is safe
to add without touching anything that already works.
Prior art worth noting: Views Alpha Pager (D6 era, comment #1 above) and the alpha_pagination D8 port (#2821493) both took a
similar rendering-layer approach in contrib.
Question for maintainers before I start building: Is the summary style layer the right place for this, or is there a preferred
architectural direction on main? Happy to attach a working proof-of-concept to this comment if that would help the review.