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()

#2004872: [meta] Theme system architecture changes
#2035055: Introduce hook_theme_prepare[_alter]() and remove hook_preprocess_HOOK()

Comments

c4rl’s picture

Status: Active » Closed (duplicate)
markhalliwell’s picture

Version: 9.x-dev » 8.x-dev
Status: Closed (duplicate) » Postponed

Actually, 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.

star-szr’s picture

Version: 8.0.x-dev » 9.x-dev
catch’s picture

Status: Postponed » Closed (duplicate)

Marking 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.

Version: 9.x-dev » 9.0.x-dev

The 9.0.x branch will open for development soon, and the placeholder 9.x branch should no longer be used. Only issues that require a new major version should be filed against 9.0.x (for example, removing deprecated code or updating dependency major versions). New developments and disruptive changes that are allowed in a minor version should be filed against 8.9.x, and significant new features will be moved to 9.1.x at committer discretion. For more information see the Allowed changes during the Drupal 8 and 9 release cycles and the Drupal 9.0.0 release plan.