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
- review
- commit
- open follow-up #2873117: Remove ArrayAccess from ThemeHook
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
objectsThemeHook
implements ArrayAccess
for BC purposes.
Data model changes
N/A