[development] module_preprocess_hook not always called

Earl Miles merlin at logrus.com
Tue Jul 29 16:37:34 UTC 2008


Matt Connolly wrote:
> No. My question is WHY?

For one, you really can't use the preprocessors with a theme function. 
With a template, you get a nice handy box of variables and you can do 
what you want with it. With a theme function, you get the variables that 
were defined, and that's it. Sure, theoretically you could massage those 
X variables a bit.

The real reason, though, is performance. Templates take up to five times 
as long to run as theme functions; and Drupal has a couple of places 
where a single theme function might be called fifty or a hundred times 
on a page.

This is discussed here: http://drupal.org/node/173880 and there is 
another mention of it here in the module developer's guide where we 
discuss that side of using the theme layer: http://drupal.org/node/165706




More information about the development mailing list