In a recent patch we added preprocess functions for theme functions.

Unfortunately, theme functions received a fixed list of variables. All a preprocess function can do is modify them. This has 2 problems: 1) new variables cannot be added, and 2) any changes to existing variables destroys data. Both of these turn this into a very hard to use DX WTF. For an example of this, see the discussion on http://drupal.org/node/565792

My proposed solution is simple: All theme functions receive exactly one argument, and that argument is the $variables array that preprocess functions get fed. It does mean that there is an API shift on existing theme functions, but I think this is an important one:

1) Theme functions are now used MUCH less than templates and
2) It allows theme functions to make proper use of preprocess where it makes sense.

Before putting in a patch, I'd like to elicit some discussion.

Comments

merlinofchaos’s picture

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

Status: Closed (duplicate) » Active

Coming from a themer... +1

joshmiller’s picture

Status: Active » Closed (duplicate)

cross post

Zarabadoo’s picture

Also a themer, and I am in approval.