Preprocess Functions (theme_hook) Drupal

Allow one module to alter the variable used by another module when it call a theme hook.

template_preprocess_node(&$variables) 
  -> Process variables for node.tpl.php

template_preprocess_page(&$variables)
   -> Process variables for page.tpl.php

[module]_preprocess_[theme hookname]  (&$variables)

multi-hook preprocess functions
[module]_preprocess (&$variables, $hook)

Order of preprocess execution
-------------------------------------
All Preprocess functions run before all process functions

1. template_preprocess()
2. template_preprocess_Hook()
3. module_preprocess()
4. module_preprocess_Hook()
5. theme_preprocess()
6. theme_preproces_Hook()

7. template_process()
8. template_process_Hook()
9. module_process()
10. module_process_Hook()
11. theme_process()
12. theme_proces_Hook()

Note:
In drupal 7, there are 184 theme hooks,
Many of those theme hooks are specific to a core module's usage, like theming an administration form.

Common theme hooks
---------------------------
file_link, html_tag, image, image_style, item_list, links, more_link, pager, progress_bar, table, username, user_list, user_picture

Tags