Improve DX of template_preprocess_pager

Created on 15 April 2024, 8 months ago

Problem/Motivation

The body of the function template_preprocess_pager is 128 lines long and is hard to parse or manipulate.

It seems to be broken up in to a number of logical parts, some of which even have comments to indicate where the current step ends.

  1. Initialize local variables
  2. Early returns
  3. Calculate various markers
  4. Prepare for generation loop
  5. Create the "first" and "previous" links
  6. Add an ellipsis
  7. Generate the actual pager
  8. Add an ellipsis
  9. Create the "next" and "last" links
  10. Set theming ArrayPI values
  11. Set cache context

Steps to reproduce

N/A

Proposed resolution

Provide a helper class to generate the pager variables, with logically split up methods and properties.

Remaining tasks

  • Determine the best structure
  • Implement

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.0 🔥

Component
Theme 

Last updated 28 minutes ago

Created by

🇦🇺Australia mstrelan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024