Convert theme hooks (defined by hook_theme()) to be objects

Created on 24 March 2017, over 7 years ago
Updated 30 January 2023, almost 2 years ago

Problem/Motivation

There have been multiple issues lately involving the theme registry.
Because the theme hook arrays are passed around to many places, it is very difficult to track down which code is modifying which key.
It is also hard to full understand the ways that certain keys interact together.

This is very similar to the issues with the $form_state arrays in D7 and before.

Proposed resolution

Mimic the same solution used for $form_state: create a class to hold these theme hooks.
This time, we'll need full BC.

Remaining tasks

N/A

User interface changes

N/A

API changes

API addition and deprecation, no breaking changes
hook_theme() should now return an array of \Drupal\Core\Theme\ThemeHook objects
ThemeHook implements ArrayAccess for BC purposes.

Data model changes

N/A

📌 Task
Status

Needs work

Version

10.1 ✨

Component
Theme  →

Last updated 4 days ago

Created by

🇺🇸United States tim.plunkett Philadelphia

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

  • Needs performance review

    It is used to alert the performance topic maintainer(s) that an issue significantly affects (or has the potential to affect) the performance of Drupal, and their signoff is needed. See the governance policy draft and Drupal Core gate - performance for more information.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024