Preprocessing for uswds_images variable should be more granular

Created on 23 April 2025, 2 days ago

Problem/Motivation

Not so much a bug, but more of an inefficiency.

The variable uswds_images is defined in uswds_base_preprocess, so it is available in all templates. However within the theme, this variable is only used in the page template, the pager templates, search block, and the government banner. This results in this variable being added in many instances where it is not needed.

Steps to reproduce

Add a debug statement in the preprocess hook and load the site to count how many times the preprocessing is called.

Proposed resolution

Instead of adding the variable to all templates, only provide the variable when it is relevant.

  • Page template
  • Pager template (including mini pager)
  • Government Banner template
  • Search block template

Remaining tasks

TDB

User interface changes

None

API changes

TBD

Data model changes

None

πŸ› Bug report
Status

Active

Version

3.10

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States tregonia

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

Comments & Activities

Production build 0.71.5 2024