Problem/Motivation
The current theme system is a complicated mix of sub systems that pass data back and forth to one another in ways that confuses new users, and causes bugs. @see #939462: Specific preprocess functions for theme hook suggestions are not invoked
We've solved many of these problems in Drupal 8 by re-architecting the theme layer, but sadly were not able to get everything done before code freeze. We've stopped using the preprocess hooks, and have deprecated them, but were not able to remove them in the Drupal 8 release cycle.
@see #2004872: [meta] Theme system architecture changes
Proposed resolution
Remove the preprocess layer.
Remaining tasks
- Remove hook_preprocess()
- Remove hook_preprocess_HOOK()
- Remove all references to preprocess in docs
User interface changes
None.
API changes
- Removal of hook_preprocess()
- Removal of hook_preprocess_HOOK()
Related Issues
#2004872: [meta] Theme system architecture changes
#2035055: Introduce hook_theme_prepare[_alter]() and remove hook_preprocess_HOOK()
Comments
Comment #1
c4rl CreditAttribution: c4rl commentedI'm marking this as a duplicate since I believe it is accommodated by both #2035055: Introduce hook_theme_prepare[_alter]() and remove hook_preprocess_HOOK() and #2060773: [META] Migrate hook_preprocess() functions to template plugin prepare() methods
Comment #2
markhalliwellActually, no this issue is still needed:
Introduce new API, deprecate old API: #2035055: Introduce hook_theme_prepare[_alter]() and remove hook_preprocess_HOOK()
Migrate old API -> new API: #2060773: [META] Migrate hook_preprocess() functions to template plugin prepare() methods
This issue:
Complete removal of all documentation, tests and the actual invocation of hook_preprocess_HOOK() in the theme() function. This should be completely separate from the other two issues so we don't step on any toes and accidentally overlook something.
Marking postponed on previously mentioned issues though. Also moving back to 8.x as we really shouldn't have "two" ways to do something by release. This is something that should just die.
Comment #3
mgiffordComment #4
star-szrComment #5
catchMarking duplicate of #2702061: Unify & simplify render & theme system: component-based rendering (enables pattern library, style guides, interface previews, client-side re-rendering), which if we do it, would significantly gut the preprocess layer in 8.x via issues like #2701667: Remove template_preprocess_responsive_image(). In order to remove the layer, we need to replace it first.