More preprocessing

This screencast shows some more useful things with preprocess functions:

  • How to add a new CSS class in a preprocess function.
  • That you can call drupal_add_css and drupal_add_js to load new CSS or JS files.
  • There is a general hook_preprocess, called for *all* template files. Use with care.
  • There is a hook_process_HOOK being called after the preprocess functions, usually to do things like flatten arrays and other data provided by preprocess hooks.
  • Again: You should be aware of what kind of data you're working with in preprocess functions. (User names, for example, may contain spaces!)